aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-01-30 21:24:34 +0000
committerBill Nottingham <notting@redhat.com>2001-01-30 21:24:34 +0000
commit178a30869d447ebc8a4d9e243813f5429dc9a950 (patch)
tree48cdef859b021f9f25ed80b8b8e9622992908716 /rc.d/init.d
parent513953f9cca632e75f9e8f5b99b77a4e0758b411 (diff)
downloadinitscripts-178a30869d447ebc8a4d9e243813f5429dc9a950.tar
initscripts-178a30869d447ebc8a4d9e243813f5429dc9a950.tar.gz
initscripts-178a30869d447ebc8a4d9e243813f5429dc9a950.tar.bz2
initscripts-178a30869d447ebc8a4d9e243813f5429dc9a950.tar.xz
initscripts-178a30869d447ebc8a4d9e243813f5429dc9a950.zip
for daemon(), look only at the pid file to see if it's running (#17244, others)
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-xrc.d/init.d/functions24
1 files changed, 22 insertions, 2 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 86d1c3c0..24e99948 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -101,8 +101,8 @@ daemon() {
# Save basename.
[ -z $gotbase ] && base=`basename $1`
- # See if it's already running.
- pidlist=`pidofproc $1`
+ # See if it's already running. Look *only* at the pid file.
+ pidlist=`pidfileofproc $1`
pid=
for apid in $pidlist ; do
@@ -197,6 +197,26 @@ killproc() {
return $RC
}
+# A function to find the pid of a program. Looks *only* at the pidfile
+pidfileofproc() {
+ base=`basename $1`
+
+ # Test syntax.
+ if [ $# = 0 ] ; then
+ echo $"Usage: pidofproc {program}"
+ return 1
+ fi
+
+ # First try "/var/run/*.pid" files
+ if [ -f /var/run/${base}.pid ] ; then
+ pid=`cat /var/run/${base}.pid | { read foo ; echo $foo ; }`
+ if [ "$pid" != "" ] ; then
+ echo $pid
+ return 0
+ fi
+ fi
+}
+
# A function to find the pid of a program.
pidofproc() {
base=`basename $1`