On 17 May 2018 at 11:58, Mantas MikulÄ?nas <grawity at gmail.com> wrote: > this would be anyways broken because systemd reads the PIDFile once at > start to dtermine MAINPID and if MAINPID goes away the service fails This is not true as with PIDFile systemd does pick up the new process as a new main without restarting the unit. This is an example from my development VM: systemctl status nginx ... Active: active (running) since Thu 2018-05-17 11:02:57 UTC; 3min 18s ago Docs: man:nginx(8) Process: 2407 ExecStart=/usr/sbin/nginx ... Main PID: 2408 (nginx) CGroup: /system.slice/nginx.service â??â??2408 nginx: master process ... â??â??2409 nginx: worker process â??â??2410 nginx: worker process Initiate a graceful restart of nginx: kill -s USR2 2408 systemctl status nginx ... Active: active (running) since Thu 2018-05-17 11:02:57 UTC; 5min ago Docs: man:nginx(8) Process: 2407 ExecStart=/usr/sbin/nginx ... Main PID: 2408 (nginx) CGroup: /system.slice/nginx.service â??â??2408 nginx: master process /usr/sbin/nginx ... â??â??2409 nginx: worker process â??â??2410 nginx: worker process â??â??2418 nginx: master process /usr/sbin/nginx ... â??â??2419 nginx: worker process â??â??2420 nginx: worker process Notice that there are 2 master processes, the old one with pid 2408 and the one 2418. Initiate the shutdown of the initial master: kill -s QUIT 2408 systemctl status nginx Active: active (running) since Thu 2018-05-17 11:02:57 UTC; 7min ago Docs: man:nginx(8) Process: 2407 ExecStart=/usr/sbin/nginx -c /vol/opt/act/webapp/nginx/nginx.conf -g daemon on; master_process on; worker_processes auto; pid /run/nginx/nginx.pid; error_log sys Main PID: 2418 (nginx) CGroup: /system.slice/nginx.service â??â??2418 nginx: master process /usr/sbin/nginx -c /vol/opt/act/webapp/nginx/nginx.conf -g daemon on; master_process on; worker_processes auto; pid /run/nginx/nginx.pid; â??â??2419 nginx: worker process â??â??2420 nginx: worker process Here systemd correctly recognized 2418 as the new master without restarting the unit as seen by active time.