1 |
#!/bin/sh |
2 |
# puppetmaster This shell script enables the puppetmaster server. |
3 |
# |
4 |
# Author: Duane Griffin <d.griffin@psenterprise.com> |
5 |
# Martin Vuk <martin.vuk@fri.uni-lj.si> (SuSE support) |
6 |
# |
7 |
# chkconfig: - 65 45 |
8 |
# |
9 |
# description: Server for the puppet system management tool. |
10 |
# processname: puppetmaster |
11 |
# config: /etc/sysconfig/puppetmasterd |
12 |
|
13 |
### BEGIN INIT INFO |
14 |
# Provides: puppetmaster |
15 |
# Required-Start: $local_fs $network $syslog |
16 |
# Should-Start: |
17 |
# Required-Stop: |
18 |
# Default-Start: 3 4 5 |
19 |
# Default-Stop: 0 1 2 6 |
20 |
# Short-Description: Starts the puppetmasterd daemon (for Puppet server) |
21 |
# Description: puppetmasterd is the server for the puppet system management tool. |
22 |
### END INIT INFO |
23 |
|
24 |
# Local variables |
25 |
DAEMON_NAME=puppetmasterd |
26 |
DAEMON_PROCESS=$DAEMON_NAME |
27 |
DAEMON_BINARY=/usr/sbin/$DAEMON_PROCESS |
28 |
LOCKFILE=/var/lock/subsys/$DAEMON_PROCESS |
29 |
PIDFILE=/var/run/$DAEMON_PROCESS.pid |
30 |
|
31 |
# Source function library. |
32 |
. /etc/rc.d/init.d/functions |
33 |
|
34 |
# Source networking configuration. |
35 |
. /etc/sysconfig/network |
36 |
|
37 |
# Check that networking is up. |
38 |
[ ${NETWORKING} = "no" ] && exit 0 |
39 |
|
40 |
# load service configuration |
41 |
[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME |
42 |
|
43 |
[ -z "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_MANIFEST=/etc/puppet/manifests/site.pp |
44 |
[ -z "$PUPPETMASTER_LOG" ] && PUPPETMASTER_LOG="/var/log/puppet/puppetmaster.log" |
45 |
OPTIONS=" |
46 |
--manifest=$PUPPETMASTER_MANIFEST \ |
47 |
--logdest=$PUPPETMASTER_LOG \ |
48 |
$PUPPETMASTER_EXTRA_OPTS" |
49 |
|
50 |
start() { |
51 |
if [ ! -r $PUPPETMASTER_MANIFEST ]; then |
52 |
gprintf "Manifest file does not exist: $PUPPETMASTER_MANIFEST" |
53 |
failure "Manifest file does not exist: $PUPPETMASTER_MANIFEST" |
54 |
RETVAL=1 |
55 |
# Check if it is already running |
56 |
elif [ ! -f $LOCKFILE ]; then |
57 |
gprintf "Starting %s daemon: " "$DAEMON_NAME" |
58 |
daemon $DAEMON_BINARY $OPTIONS |
59 |
RETVAL=$? |
60 |
[ $RETVAL -eq 0 ] && touch $LOCKFILE |
61 |
fi |
62 |
echo |
63 |
return $RETVAL |
64 |
} |
65 |
|
66 |
stop() { |
67 |
gprintf "Stopping %s daemon: " "$DAEMON_NAME" |
68 |
killproc $DAEMON_PROCESS |
69 |
RETVAL=$? |
70 |
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE |
71 |
echo |
72 |
return $RETVAL |
73 |
} |
74 |
|
75 |
restart() { |
76 |
stop |
77 |
start |
78 |
} |
79 |
|
80 |
# reload() { |
81 |
# echo "Reloading $DAEMON_NAME configuration" |
82 |
# killproc $DAEMON_PROCESS SIGHUP |
83 |
# RETVAL=$? |
84 |
# echo |
85 |
# } |
86 |
|
87 |
|
88 |
case "$1" in |
89 |
start) |
90 |
start |
91 |
;; |
92 |
stop) |
93 |
stop |
94 |
;; |
95 |
restart|reload) |
96 |
restart |
97 |
;; |
98 |
condrestart|condreload) |
99 |
if [ -f $LOCKFILE ]; then |
100 |
restart |
101 |
fi |
102 |
;; |
103 |
status) |
104 |
status $DAEMON_PROCESS |
105 |
RETVAL=$? |
106 |
;; |
107 |
*) |
108 |
echo "Usage: $0 {start|stop|restart|reload|condrestart|condreload|status}" |
109 |
RETVAL=1 |
110 |
;; |
111 |
esac |
112 |
|
113 |
exit $RETVAL |