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 --- ChangeLog | 9 +++++++++ initscripts.spec | 8 +++++++- rc.d/init.d/functions | 11 ++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1001161c..dfa4eae3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-02-15 Nalin Dahyabhai + + * initscripts.spec: 5.64.2-1 + + * rc.d/init.d/functions: + fix killproc, pidofproc, and status looking at or killing the wrong + daemon when they share the same basename but are in different + directories + 2001-02-14 Bill Nottingham * initscripts.spec: 5.64.1-1 diff --git a/initscripts.spec b/initscripts.spec index d8be812a..02f7fde9 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,6 +1,6 @@ Summary: The inittab file and the /etc/init.d scripts. Name: initscripts -Version: 5.64.1 +Version: 5.64.2 Copyright: GPL Group: System Environment/Base Release: 1 @@ -254,6 +254,12 @@ rm -rf $RPM_BUILD_ROOT %ghost %attr(0664,root,utmp) /var/run/utmp %changelog +* Thu Feb 15 2001 Nalin Dahyabhai +- 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 + * Wed Feb 14 2001 Bill Nottingham - fix init.d/single to work around possible kernel problem 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