conf/redhat/*.init: Use -p option to killproc

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 <tmz@pobox.com>
This commit is contained in:
Todd Zullinger 2009-10-25 11:00:42 -04:00
Родитель f47a70f46b
Коммит 9dff7167b7
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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"