diff options
author | Michael K. Johnson <johnsonm@redhat.com> | 1998-09-21 19:38:03 +0000 |
---|---|---|
committer | Michael K. Johnson <johnsonm@redhat.com> | 1998-09-21 19:38:03 +0000 |
commit | 988192c13113c11f4273cffd67092af46337ca67 (patch) | |
tree | 825d871f0234394fbe05838c771099abe1fdf764 /rc.d/init.d | |
parent | dabeb5ab66dc5ee6274cc5ec323e9c30707cd934 (diff) | |
download | initscripts-988192c13113c11f4273cffd67092af46337ca67.tar initscripts-988192c13113c11f4273cffd67092af46337ca67.tar.gz initscripts-988192c13113c11f4273cffd67092af46337ca67.tar.bz2 initscripts-988192c13113c11f4273cffd67092af46337ca67.tar.xz initscripts-988192c13113c11f4273cffd67092af46337ca67.zip |
a few bugs fixed and a few unneeded processes removed
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-x | rc.d/init.d/functions | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index f40ace44..e33554ab 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -27,7 +27,8 @@ daemon() { base=`basename $1` # See if it's already running. - [ "`pidofproc $base`" != "" ] && return + pid=`pidofproc $base` + [ -n "$pid" ] && ps h $pid >/dev/null 2>&1 && return # echo basename of the program. echo -n "$base " @@ -70,8 +71,7 @@ killproc() { # TERM first, then KILL if not dead kill -TERM $pid usleep 100000 - dead=`ps aux | awk '{print $2}' | grep $pid` - if [ "$dead" != "" ]; then + if ps h $pid >/dev/null 2>&1 ; then sleep 3 kill -KILL $pid fi @@ -112,7 +112,7 @@ pidofproc() { # Finally try to extract it from ps ps auxw | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } { if ((prog == $11) || (("(" prog ")") == $11) || - ((prog ":") == $11)) { print $2 } }' $1 + ((prog ":") == $11)) { print $2 ; exit 0 } }' $1 } status() { # Test syntax. @@ -127,7 +127,7 @@ status() { echo "$1 (pid $pid) is running..." return 0 else - pid=`ps auxww | grep $1 | egrep -v grep\|$0 | awk '{print $2}'` + pid=`ps auxww | grep '[^[]'$1 | awk '{print $2}'` if [ "$pid" != "" ] ; then echo "$1 (pid $pid) is running..." return 0 |