diff options
author | Todd Zullinger <tmz@pobox.com> | 2009-10-27 01:03:33 -0400 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-13 23:09:37 -0700 |
commit | 04228528d1f8e4d36e1643ac0cf51281b81ef9fb (patch) | |
tree | bdc872760ef5174378f2bd84c2d493f13a52b92c /conf | |
parent | 63bf037dc297c8cd59a02dc1fea0961014542344 (diff) | |
download | puppet-04228528d1f8e4d36e1643ac0cf51281b81ef9fb.tar.gz puppet-04228528d1f8e4d36e1643ac0cf51281b81ef9fb.tar.xz puppet-04228528d1f8e4d36e1643ac0cf51281b81ef9fb.zip |
conf/redhat: Consistently pass pidfile option to daemon, killproc, and status
In Red Hat bug #531116 Ruben Kerkhof noted that we weren't using the
--pidfile $pidfile option to daemon. This caused 'service puppet start'
to fail if puppet had already been started. To be consistent, we now
pass the pidfile option to daemon, killproc, and status when those
functions provide such an option. And we only test for the availability
of the -p/--pidfile option in one place.
Diffstat (limited to 'conf')
-rw-r--r-- | conf/redhat/client.init | 17 | ||||
-rw-r--r-- | conf/redhat/server.init | 14 |
2 files changed, 20 insertions, 11 deletions
diff --git a/conf/redhat/client.init b/conf/redhat/client.init index 04e0d27f2..f624d8181 100644 --- a/conf/redhat/client.init +++ b/conf/redhat/client.init @@ -27,8 +27,12 @@ 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" +# Determine if we can use the -p option to daemon, killproc, and status. +# RHEL < 5 can't. +if status | grep -q -- '-p' 2>/dev/null; then + daemonopts="--pidfile $pidfile" + pidopts="-p $pidfile" +fi # Figure out if the system just booted. Let's assume # boot doesn't take longer than 5 minutes @@ -37,7 +41,7 @@ killproc | grep -q -- '-p' 2>/dev/null && killopts="-p $pidfile" start() { echo -n $"Starting puppet: " - daemon $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} + daemon $daemonopts $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} @@ -46,7 +50,7 @@ start() { stop() { echo -n $"Stopping puppet: " - killproc $killopts $puppetd + killproc $pidopts $puppetd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} @@ -54,7 +58,7 @@ stop() { reload() { echo -n $"Restarting puppet: " - killproc $killopts $puppetd -HUP + killproc $pidopts $puppetd -HUP RETVAL=$? echo return $RETVAL @@ -66,8 +70,7 @@ restart() { } rh_status() { - status | grep -q -- '-p' 2>/dev/null && statusopts="-p $pidfile" - status $statusopts $puppetd + status $pidopts $puppetd RETVAL=$? return $RETVAL } diff --git a/conf/redhat/server.init b/conf/redhat/server.init index 3d2897d27..4d3a72c0e 100644 --- a/conf/redhat/server.init +++ b/conf/redhat/server.init @@ -33,6 +33,13 @@ fi PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \ ${PUPPETMASTER_EXTRA_OPTS}" +# Determine if we can use the -p option to daemon, killproc, and status. +# RHEL < 5 can't. +if status | grep -q -- '-p' 2>/dev/null; then + daemonopts="--pidfile $pidfile" + pidopts="-p $pidfile" +fi + RETVAL=0 prog=puppetmasterd @@ -50,7 +57,7 @@ start() { ret=$?; [ $ret != 0 ] && RETVAL=$ret done else - daemon $PUPPETMASTER $PUPPETMASTER_OPTS + daemon $daemonopts $PUPPETMASTER $PUPPETMASTER_OPTS RETVAL=$? fi else @@ -72,8 +79,7 @@ stop() { ret=$?; [ $ret != 0 ] && RETVAL=$ret done else - killproc | grep -q -- '-p' 2>/dev/null && killopts="-p $pidfile" - killproc $killopts $PUPPETMASTER + killproc $pidopts $PUPPETMASTER RETVAL=$? fi echo @@ -99,7 +105,7 @@ rh_status() { ret=$?; [ $ret != 0 ] && RETVAL=$ret done else - status $PUPPETMASTER + status $pidopts $PUPPETMASTER RETVAL=$? fi return $RETVAL |