From 7a7946ddfb32d33e0529c4362d8efd76781a4784 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 21 Jan 2000 04:58:07 +0000 Subject: put ps|grep|awk back in until we think of something better (pidof -x ain't it) --- rc.d/init.d/functions | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index bd8c3eb8..6f1ce97c 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -183,11 +183,17 @@ pidofproc() { fi # Next try "pidof" - pid=`pidof -x $1` + pid=`pidof $1` if [ "$pid" != "" ] ; then echo $pid return 0 fi + + # Finally try to extract it from ps + ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } + { if ((prog == $5) || (("(" prog ")") == $5) || + (("[" prog "]") == $5) || + ((prog ":") == $5)) { print $1 ; exit 0 } }' $1 } status() { @@ -198,10 +204,19 @@ status() { fi # First try "pidof" - pid=`pidof -x $1` + pid=`pidof $1` if [ "$pid" != "" ] ; then echo "$1 (pid $pid) is running..." return 0 + else + pid=`ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } + { if ((prog == $5) || (("(" prog ")") == $5) || + (("[" prog "]") == $5) || + ((prog ":") == $5)) { print $1 ; exit 0 } }' $1` + if [ "$pid" != "" ] ; then + echo "$1 (pid $pid) is running..." + return 0 + fi fi # Next try "/var/run/*.pid" files -- cgit v1.2.1