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.
---
conf/redhat/client.init | 17 ++++++++++-------
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 04e0d27..f624d81 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 3d2897d..4d3a72c 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
--
1.7.1
--
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.