2
# puppet Init script for running the puppet client daemon
4
# Author: Duane Griffin <d.griffin@psenterprise.com>
5
# David Lutterkort <dlutter@redhat.com>
6
# Martin Vuk <martin.vuk@fri.uni-lj.si> (SuSE support)
10
# description: Enables periodic system configuration checks through puppet.
12
# config: /etc/sysconfig/puppet
16
# Required-Start: $local_fs $remote_fs $network $syslog
17
# Should-Start: puppet
18
# Required-Stop: $local_fs $remote_fs $network $syslog
20
# Default-Start: 3 4 5
21
# Default-Stop: 0 1 2 6
22
# Short-Description: puppet
23
# Description: Enables periodic system configuration checks through puppet.
26
# Shell functions sourced from /etc/rc.status:
27
# rc_check check and set local and overall rc status
28
# rc_status check and set local and overall rc status
29
# rc_status -v ditto but be verbose in local rc status
30
# rc_status -v -r ditto and clear the local rc status
31
# rc_failed set local and overall rc status to failed
32
# rc_reset clear local rc status (overall remains)
33
# rc_exit exit appropriate to overall rc status
34
[ -f /etc/rc.status ] && . /etc/rc.status
35
[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
36
lockfile=${LOCKFILE-/var/lock/subsys/puppet}
37
pidfile=${PIDFILE-/var/run/puppet.pid}
38
puppetd=${PUPPETD-/usr/sbin/puppetd}
41
[ -n "${PUPPET_SERVER}" ] && PUPPET_OPTS="--server=${PUPPET_SERVER}"
42
[ -n "$PUPPET_LOG" ] && PUPPET_OPTS="${PUPPET_OPTS} --logdest=${PUPPET_LOG}"
43
[ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} --port=${PUPPET_PORT}"
45
# First reset status of this service
48
# Return values acc. to LSB for all commands but status:
51
# 2 - invalid or excess args
52
# 3 - unimplemented feature (e.g. reload)
53
# 4 - insufficient privilege
54
# 5 - program not installed
55
# 6 - program not configured
57
# Note that starting an already running service, stopping
58
# or restarting a not-running service as well as the restart
59
# with force-reload (in case signalling is not supported) are
60
# considered a success.
64
echo -n "Starting puppet services."
65
## Start daemon with startproc(8). If this fails
66
## the echo return value is set appropriate.
68
# startproc should return 0, even if service is
69
# already running to match LSB spec.
70
startproc $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} && touch ${lockfile}
71
# Remember status and be verbose
75
echo -n "Shutting down puppet:"
76
## Stop daemon with killproc(8) and if this fails
77
## set echo the echo return value.
79
killproc -QUIT $puppetd && rm -f ${lockfile} ${pidfile}
81
# Remember status and be verbose
85
## Stop the service and if this succeeds (i.e. the
86
## service was running before), start it again.
87
$0 status >/dev/null && $0 restart
89
# Remember status and be quiet
93
## Stop the service and regardless of whether it was
94
## running or not, start it again.
98
# Remember status and be quiet
102
## Signal the daemon to reload its config. Most daemons
103
## do this on signal 1 (SIGHUP).
104
## If it does not support it, restart.
106
echo -n "Reload service puppet"
107
## if it supports it:
108
killproc -HUP $puppetd
112
## Like force-reload, but if daemon does not support
113
## signalling, do nothing (!)
115
# If it supports signalling:
116
echo -n "Reload puppet services."
117
killproc -HUP $puppetd
121
echo -n "Checking for service puppetd: "
122
## Check status with checkproc(8), if process is running
123
## checkproc will return with exit status 0.
125
# Status has a slightly different for the status command:
126
# 0 - service running
127
# 1 - service dead, but /var/run/ pid file exists
128
# 2 - service dead, but /var/lock/ lock file exists
129
# 3 - service not running
131
# NOTE: checkproc returns LSB compliant status values.
137
$puppetd -o ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} $@
140
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|once}"