aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2000-01-14 18:00:52 +0000
committerBill Nottingham <notting@redhat.com>2000-01-14 18:00:52 +0000
commit7769feeb20acbcbbdd0f10e262df00ed12db84e6 (patch)
treed2f2ff7a199980e0dd4a09ee3b40bf2dbf192446 /rc.d/init.d
parent06915c1dbf6936197df4d36a1066494ad0869289 (diff)
downloadinitscripts-7769feeb20acbcbbdd0f10e262df00ed12db84e6.tar
initscripts-7769feeb20acbcbbdd0f10e262df00ed12db84e6.tar.gz
initscripts-7769feeb20acbcbbdd0f10e262df00ed12db84e6.tar.bz2
initscripts-7769feeb20acbcbbdd0f10e262df00ed12db84e6.tar.xz
initscripts-7769feeb20acbcbbdd0f10e262df00ed12db84e6.zip
remove ps |grep|awk construct
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-xrc.d/init.d/functions19
1 files changed, 2 insertions, 17 deletions
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