2
# puppetmaster This shell script enables the puppetmaster server.
4
# Author: Duane Griffin <d.griffin@psenterprise.com>
5
# Martin Vuk <martin.vuk@fri.uni-lj.si> (SuSE support)
9
# description: Server for the puppet system management tool.
10
# processname: puppetmaster
13
# Provides: puppetmaster
14
# Required-Start: $local_fs $remote_fs $network $syslog
15
# Should-Start: puppetmaster
16
# Required-Stop: $local_fs $remote_fs $network $syslog
17
# Should-Stop: puppetmaster
18
# Default-Start: 3 4 5
19
# Default-Stop: 0 1 2 6
20
# Short-Description: puppetmaster
21
# Description: Server for the puppet system management tool.
24
# Shell functions sourced from /etc/rc.status:
25
# rc_check check and set local and overall rc status
26
# rc_status check and set local and overall rc status
27
# rc_status -v ditto but be verbose in local rc status
28
# rc_status -v -r ditto and clear the local rc status
29
# rc_failed set local and overall rc status to failed
30
# rc_reset clear local rc status (overall remains)
31
# rc_exit exit appropriate to overall rc status
33
lockfile=/var/lock/subsys/puppetmaster
34
pidfile=/var/run/puppet/puppetmasterd.pid
36
# Source function library.
37
[ -f /etc/rc.status ] && . /etc/rc.status
39
if [ -f /etc/sysconfig/puppetmaster ]; then
40
. /etc/sysconfig/puppetmaster
44
[ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="--manifest=${PUPPETMASTER_MANIFEST}"
45
if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
46
PUPPETMASTER_OPTS="$PUPPETMASTER_OPTS --servertype=mongrel"
47
elif [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -eq 1 ]; then
48
PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --masterport=${PUPPETMASTER_PORTS[0]}"
50
[ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest ${PUPPETMASTER_LOG}"
51
PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \
52
${PUPPETMASTER_EXTRA_OPTS}"
55
PUPPETMASTER=/usr/sbin/$prog
58
echo -n $"Starting puppetmaster: "
63
# First reset status of this service
66
# Return values acc. to LSB for all commands but status:
69
# 2 - invalid or excess args
70
# 3 - unimplemented feature (e.g. reload)
71
# 4 - insufficient privilege
72
# 5 - program not installed
73
# 6 - program not configured
75
# Note that starting an already running service, stopping
76
# or restarting a not-running service as well as the restart
77
# with force-reload (in case signalling is not supported) are
78
# considered a success.
82
echo -n "Starting puppetmaster services."
83
## Start daemon with startproc(8). If this fails
84
## the echo return value is set appropriate.
86
# startproc should return 0, even if service is
87
# already running to match LSB spec.
88
# Confirm the manifest exists
89
if [ -r $PUPPETMASTER_MANIFEST ]; then
90
startproc $PUPPETMASTER $PUPPETMASTER_OPTS && touch "$lockfile"
93
echo "Manifest does not exist: $PUPPETMASTER_MANIFEST"
95
# Remember status and be verbose
99
echo -n "Shutting down puppetmaster:"
100
## Stop daemon with killproc(8) and if this fails
101
## set echo the echo return value.
103
killproc -QUIT $PUPPETMASTER && rm -f ${lockfile} ${pidfile}
105
# Remember status and be verbose
109
## Stop the service and if this succeeds (i.e. the
110
## service was running before), start it again.
111
$0 status >/dev/null && $0 restart
113
# Remember status and be quiet
117
## Stop the service and regardless of whether it was
118
## running or not, start it again.
122
# Remember status and be quiet
126
## Signal the daemon to reload its config. Most daemons
127
## do this on signal 1 (SIGHUP).
128
## If it does not support it, restart.
130
echo -n "Reload service puppet"
131
## if it supports it:
132
killproc -HUP $PUPPETMASTER
136
## Like force-reload, but if daemon does not support
137
## signalling, do nothing (!)
139
# If it supports signalling:
140
echo -n "Reload puppet services."
141
killproc -HUP $PUPPETMASTER
145
echo -n "Checking for service puppetmaster: "
146
## Check status with checkproc(8), if process is running
147
## checkproc will return with exit status 0.
149
# Status has a slightly different for the status command:
150
# 0 - service running
151
# 1 - service dead, but /var/run/ pid file exists
152
# 2 - service dead, but /var/lock/ lock file exists
153
# 3 - service not running
155
# NOTE: checkproc returns LSB compliant status values.
156
checkproc $PUPPETMASTER
160
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"