On 17 May 2018 at 12:07, Michael Chapman <mike at very.puzzling.org> wrote: > It _is_ better for the PID file to be written out before the initial > process exits, but systemd will handle things correctly even if they > happen the other way around. Essentially the service won't be considered > to have completed activation until both events occur. If one or the other > takes too long (i.e. longer than the TimeoutStartSec= setting), the unit > will fail. Does it means that even ExecStartPost and especially ExecReload can always safely use $MAINPID? I.e. does systemd call these Execs only after it managed to read the the pid file even when the file is written after the initial ExecStart process exited? And yes, Type=pid-file will be very useful. I have exactly a shell script that will benefit from it nicely.