Created
January 13, 2012 17:55
-
-
Save rafael/1607788 to your computer and use it in GitHub Desktop.
puppet-agent init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: puppetd | |
# Required-Start: $network $named $remote_fs $syslog | |
# Required-Stop: $network $named $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/local/bin/puppetd | |
NAME=agent | |
DAEMON_OPTS="" | |
DESC="puppet configuration management tool agent daemon" | |
test -x $DAEMON || exit 0 | |
[ -r /etc/default/puppetagent ] && . /etc/default/puppetmaster | |
. /lib/lsb/init-functions | |
if [ ! -d /var/run/puppet ]; then | |
mkdir -p /var/run/puppet | |
fi | |
chown puppet:puppet /var/run/puppet | |
start_puppetagent() { | |
start-stop-daemon --start --quiet --pidfile /var/lib/puppet/run/${NAME}.pid \ | |
--startas $DAEMON -- $DAEMON_OPTS --config=/etc/puppet/puppet.conf | |
} | |
stop_puppetagent() { | |
start-stop-daemon --stop --quiet --oknodo --pidfile /var/lib/puppet/run/${NAME}.pid | |
} | |
status_puppetagent() { | |
status_of_proc -p "/var/lib/puppet/run/${NAME}.pid" "${DAEMON}" "${NAME}" | |
} | |
case "$1" in | |
start) | |
log_begin_msg "Starting $DESC" | |
start_puppetagent | |
log_end_msg $? | |
;; | |
stop) | |
log_begin_msg "Stopping $DESC" | |
stop_puppetagent | |
log_end_msg $? | |
;; | |
reload) | |
# Do nothing, as Puppetmaster rechecks its config automatically | |
;; | |
status) | |
status_puppetagent | |
;; | |
restart|force-reload) | |
log_begin_msg "Restarting $DESC" | |
stop_puppetagent | |
sleep 1 | |
start_puppetagent | |
log_end_msg $? | |
;; | |
*) | |
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment