[CRIU] [PATCH] service: add default pidfile name

Ruslan Kuprieiev kupruser at gmail.com
Wed Feb 5 07:48:46 PST 2014


On 05.02.2014 19:42, Ruslan Kuprieiev wrote:
> On 05.02.2014 19:30, Andrew Vagin wrote:
>> It works fine without pidfile. Why do we need this?
>>
>> [root at avagin-fc19-cr ~]# systemctl start criu
>> [root at avagin-fc19-cr ~]# ps -C criu
>>    PID TTY          TIME CMD
>>   6086 ?        00:00:00 criu
>> [root at avagin-fc19-cr ~]# systemctl stop criu
>> [root at avagin-fc19-cr ~]# ps -C criu
>>    PID TTY          TIME CMD
>> [root at avagin-fc19-cr ~]#
>
> Just in case. As we have CR_DEFAULT_SERVICE_ADDRESS, I decided that it 
> will be
> right to introduce CR_DEFAULT_SERVICE_PIDFILE too.
>
> Btw, not everyone is using systemd=).
>

Also, I'm about to make logrotate config for service, so it looks like I 
need to
introduce CR_DEFAULT_SERVICE_LOGFILE too.

>> On Wed, Feb 05, 2014 at 07:26:18PM +0400, Ruslan Kuprieiev wrote:
>>> It is right for deamon to store pidfile at /var/run/ by default.
>>>
>>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>>> ---
>>>   cr-service.c               | 3 +++
>>>   include/cr-service-const.h | 1 +
>>>   2 files changed, 4 insertions(+)
>>>
>>> diff --git a/cr-service.c b/cr-service.c
>>> index 5f7f712..1f73101 100644
>>> --- a/cr-service.c
>>> +++ b/cr-service.c
>>> @@ -590,6 +590,9 @@ int cr_service(bool daemon_mode)
>>>               pr_perror("Can't run service server in the background");
>>>               goto err;
>>>           }
>>> +
>>> +        if (!opts.pidfile)
>>> +            opts.pidfile = CR_DEFAULT_SERVICE_PIDFILE;
>>>       }
>>>         if (opts.pidfile) {
>>> diff --git a/include/cr-service-const.h b/include/cr-service-const.h
>>> index 668882b..dbeb8d0 100644
>>> --- a/include/cr-service-const.h
>>> +++ b/include/cr-service-const.h
>>> @@ -3,5 +3,6 @@
>>>     #define CR_MAX_MSG_SIZE 1024
>>>   #define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket"
>>> +#define CR_DEFAULT_SERVICE_PIDFILE "/var/run/criu_service.pid"
>>>     #endif /* __CR_SERVICE_CONST_H__ */
>>> -- 
>>> 1.8.3.2
>>>
>>> _______________________________________________
>>> CRIU mailing list
>>> CRIU at openvz.org
>>> https://lists.openvz.org/mailman/listinfo/criu
>



More information about the CRIU mailing list