pidofproc function with --pidfile options

Pawel Golaszewski blues w pld-linux.org
Pon, 16 Kwi 2007, 13:59:20 CEST


On Mon, 16 Apr 2007, Jacek Konieczny wrote:
> > I had problem with:
> > killproc --pidfile 
> > 
> > when pidfile was a bit non-standard. haproxy started as 2-thread 
> > daemon, produces pid file with one pid number per line. Current 
> > rc-scripts are causing to stop only first process, the second one 
> > stays untouched. I don't know if standards allow to have such a pid 
> > but rc-scripts should handle even such a situation, IMO.
> AFAIR I have seen pid files which contained a pid number in the first 
> line, and some other data later, so I don't thin that your assumptions 
> about pid file contents are correct. Though, I am not able to find any 
> of such pid files now.

I've made a bit digging today and I've found in FHS only something like 
that:
[...]
The internal format of PID files remains unchanged. The file must consist 
of the process identifier in ASCII-encoded decimal, followed by a newline 
character. For example, if crond was process number 25, /var/run/crond.pid 
would contain three characters: two, five, and newline.

Programs that read PID files should be somewhat flexible in what they 
accept; i.e., they should ignore extra whitespace, leading zeroes, absence 
of the trailing newline, or additional lines in the PID file. Programs 
that create PID files should use the simple specification located in the 
above paragraph.
[...]

There is nothing about how many pid's are allowed and if they can be in 
new lines. The only thing is that after number should be newline 
character. IMvHO _if_ we accept multiple pids in that file we have allow 
multiple lines in pidfile.

However - if you'll find daemon that puts something else than pid here... 
the deamon should be fixed :)

-- 
pozdr.  Paweł Gołaszewski          jid:blues<at>jabber<dot>gda<dot>pl
--------------------------------------------------------------------------
If you think of MS-DOS as mono, and Windows as stereo, then Linux is Dolby
Pro-Logic Surround Sound with Bass Boost and all the music is free.


Więcej informacji o liście dyskusyjnej pld-rc-scripts