From 7769feeb20acbcbbdd0f10e262df00ed12db84e6 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 14 Jan 2000 18:00:52 +0000 Subject: remove ps |grep|awk construct --- rc.d/init.d/functions | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 18cdceef..3dfde002 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -170,17 +170,11 @@ pidofproc() { fi # Next try "pidof" - pid=`pidof $1` + pid=`pidof -x $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() { @@ -191,19 +185,10 @@ status() { fi # First try "pidof" - pid=`pidof $1` + pid=`pidof -x $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