Within my systems /run
directory I have a bunch of files that have *.pid
extensions and store the process id of running daemons, i.e.
% ls -1 /run/*.pid
acpid.pid
crond.pid
dhclient-wlp2s0.pid
irqbalance.pid
lightdm.pid
nginx.pid
rsyslogd.pid
And I have generally noticed this is something many other daemons do and that daemon management scripts in /etc/init.d/*
will read in the pid from the last running instance and reuse that on starting a new instance.
Why? why not just start the daemon and give it a new pid?
Are there other programs e.g. rsyslog, that are expecting that daemon to have that identifier and would be confused if a different program was using that pid?