[lsb-discuss] gLSB: sysinit: clearify algorithm for determining status of programs
tobias.burnus at physik.fu-berlin.de
Tue Sep 2 11:20:38 PDT 2003
On Thu, Aug 28, 2003 at 03:13:40PM -0500, George Kraft wrote:
> I'm sorry that I did not respond earlier.
> > http://freestandards.org/pipermail/lsb-discuss/2003-July/001716.html
> What about using Solaris' pkill that is implemented on Linux? Is this
> cleaner than defining pid files and directories?
Hmm, I think pkill/pgrep (despite being nice) have some drawbacks:
- pkill/pgrep are not part of SUSv3 and gLSB
- by default they don't find scripts. Real-world example:
Process: "/usr/bin/perl -wT /usr/sbin/zedv_hunter -p -d 120"
pgrep -f /usr/bin/zedv_hunter -- output ""
pgrep /usr/bin/zedv_hunter -- ""
pgrep zedv_hunter -- "703"
sorry, I don't call this reliable.
- Running the same binary twice, again real world example:
/usr/sbin/sshd /etc/ssh/sshd_config2 -p 904
Using the pid files sshd.pid and zedv-sshd2.pid they are
distinguishable. - No chance for pgrep/pkill.
My proposed patch basically says: If you want to use killproc, start_daemon or
pidofproc (which are very nice tools) then you have to save your PIDs
into the PID file. This should be really clean, required by all gLSB 1.x
and commonly used.
As usual, it's the little things that cause the big problems. And thus
the patch tries to solve these holes in the spec:
- how is the format of the PIDs (space separated, single line)
[the init functions need to be able to read this file
and the output of pidofproc has also be read]
- how should be checked whether the program is still running
[needed for start_daemon, killproc -signal and pidofproc]
-- the problem here is the above mentioned script-based daemon.
(solution: let the distibution do what they want, the "should" [SIC]
behave sensible for script-based daemons)
- killproc should clean the mess and remove unneeded pidfiles
[kill -9'ed daemons cannot do so anymore]
- Applications may use other techniques, but they are not
[as in gLSB 1.x, but a bit stronger said]
Compared with the current gLSB 1.9 the only changes are:
- [killproc] remove pidfile, if daemon is not running
- make it possible to use start_daemon etc. with script-based daemons
PS: For the distributions: They may use pidof, pgrep etc. as fallback or
as means to check whether an application is running. I don't care as
long as they recognize my script.
Debian doesn't (they check /proc/*/exe) while both RedHat (they simply
check for the existance of the /proc/$PID/ directory) and SuSE (they
use /proc/$PID/exe, then they check /proc/$PID/cmdline, then ...).
More information about the lsb-discuss