From 83f6eaa0e3224b6c84e356faa016022b53058ebd Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Thu, 15 Feb 2001 15:52:17 +0000 Subject: - make pidofproc() and killproc() try to use the PID associated with the full pathname first before killing the daemon by its basename (for daemons that share the same basename, i.e. "master" in postfix and cyrus-imapd) (#19016) - fix status() as well --- rc.d/init.d/functions | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index e1a40d84..b8303f56 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -159,7 +159,10 @@ killproc() { base=${1##*/} # Find pid. - pid=`pidofproc $base` + pid=`pidofproc $1` + if [ -z "$pid" ] ; then + pid=`pidofproc $base` + fi # Kill it. if [ -n "$pid" ] ; then @@ -207,7 +210,7 @@ pidfileofproc() { # Test syntax. if [ $# = 0 ] ; then - echo $"Usage: pidofproc {program}" + echo $"Usage: pidfileofproc {program}" return 1 fi @@ -248,6 +251,7 @@ pidofproc() { fi # Next try "pidof" + pidof -o $$ -o $PPID -o %PPID -x $1 || \ pidof -o $$ -o $PPID -o %PPID -x ${base} } @@ -262,7 +266,8 @@ status() { fi # First try "pidof" - pid=`pidof -o $$ -o $PPID -o %PPID -x ${base}` + pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \ + pidof -o $$ -o $PPID -o %PPID -x ${base}` if [ "$pid" != "" ] ; then echo $"${base} (pid $pid) is running..." return 0 -- cgit v1.2.1