If a puppetd run was started manually and 'service puppet stop' was run
the killproc function used would kill the manually started puppetd.  On
Fedora and newer RHEL (>= 5) we now use the -p option to prevent this.

This fixes #2751 (Red Hat initscripts kill an independently started
puppetd/puppetmasterd)

Signed-off-by: Todd Zullinger <[email protected]>
---

This has been pushed to tickets/0.25.x/2751 at
git://jet.mox.net/~tmz/puppet.git.

 conf/redhat/client.init |    7 +++++--
 conf/redhat/server.init |    5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/conf/redhat/client.init b/conf/redhat/client.init
index a5ac08d..0c98383 100644
--- a/conf/redhat/client.init
+++ b/conf/redhat/client.init
@@ -27,6 +27,9 @@ PUPPET_OPTS=""
 [ -n "$PUPPET_LOG" ] && PUPPET_OPTS="${PUPPET_OPTS} --logdest=${PUPPET_LOG}"
 [ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} 
--masterport=${PUPPET_PORT}"
 
+# Determine if we can use the -p option to killproc.  RHEL < 5 can't.
+killproc | grep -q -- '-p' 2>/dev/null && killopts="-p $pidfile"
+
 # Figure out if the system just booted. Let's assume
 # boot doesn't take longer than 5 minutes
 ## Not used for now
@@ -43,7 +46,7 @@ start() {
 
 stop() {
     echo -n $"Stopping puppet: "
-    killproc $puppetd
+    killproc $killopts $puppetd
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
@@ -51,7 +54,7 @@ stop() {
 
 reload() {
     echo -n $"Restarting puppet: "
-    killproc $puppetd -HUP
+    killproc $killopts $puppetd -HUP
     RETVAL=$?
     echo
     return $RETVAL
diff --git a/conf/redhat/server.init b/conf/redhat/server.init
index 4bc44b9..5505058 100644
--- a/conf/redhat/server.init
+++ b/conf/redhat/server.init
@@ -71,8 +71,9 @@ stop() {
             ret=$?; [ $ret != 0 ] && RETVAL=$ret
         done
     else
-       killproc $PUPPETMASTER
-       RETVAL=$?
+        killproc | grep -q -- '-p' 2>/dev/null && killopts="-p $pidfile"
+        killproc $killopts $PUPPETMASTER
+        RETVAL=$?
     fi
     echo
     [ $RETVAL -eq 0 ] && rm -f "$lockfile"
-- 
1.6.5.1

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Don't take life so seriously...it's not a permanent condition.
    -- Noire


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to