pidofproc function with --pidfile options

Pawel Golaszewski blues w pld-linux.org
Sob, 14 Kwi 2007, 23:20:01 CEST


Hello,

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.

Here is patch that fixes it and works in my system. Not nice but works 
pretty fine. Can it be accepted, arekm?

--- functions.org       2007-04-14 23:10:09.000000000 +0200
+++ functions   2007-04-14 23:10:25.000000000 +0200
@@ -668,7 +668,7 @@
        if [ -f "${pidfile}" ] ; then
                typeset line p pid
                pid=
-               read line < "${pidfile}"
+               line=`/bin/cat "${pidfile}"`
                for p in $line; do
                        [ -z "$(echo "$p" | awk '{gsub(/[0-9]/,"");print;}')" ] && pid="$pid $p"
                done


-- 
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