| 1 |
#! /bin/sh |
|---|
| 2 |
|
|---|
| 3 |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|---|
| 4 |
DAEMON=/usr/sbin/puppetmasterd |
|---|
| 5 |
DAEMON_OPTS="--servertype=mongrel" |
|---|
| 6 |
NAME=puppetmasterd |
|---|
| 7 |
DESC="puppet configuration management tool master server" |
|---|
| 8 |
|
|---|
| 9 |
# Run multiple puppetmasters on these ports |
|---|
| 10 |
PUPPETMASTERPORTS="18140 18141 18142 18143 18144 18145 18146 18147 18148 18149" |
|---|
| 11 |
|
|---|
| 12 |
test -x $DAEMON || exit 0 |
|---|
| 13 |
|
|---|
| 14 |
[ -r /etc/default/puppetmaster ] && . /etc/default/puppetmaster |
|---|
| 15 |
|
|---|
| 16 |
. /lib/lsb/init-functions |
|---|
| 17 |
|
|---|
| 18 |
if [ ! -d /var/run/puppet ]; then |
|---|
| 19 |
rm -rf /var/run/puppet |
|---|
| 20 |
mkdir -p /var/run/puppet |
|---|
| 21 |
fi |
|---|
| 22 |
|
|---|
| 23 |
chown puppet:puppet /var/run/puppet |
|---|
| 24 |
|
|---|
| 25 |
start_puppetmaster() { |
|---|
| 26 |
for pmp in $PUPPETMASTERPORTS; do |
|---|
| 27 |
start-stop-daemon --start --quiet --pidfile=/var/run/puppet/$NAME.$pmp.pid \ |
|---|
| 28 |
--startas $DAEMON -- $DAEMON_OPTS --masterport=$pmp --pidfile=/var/run/puppet/$NAME.$pmp.pid |
|---|
| 29 |
done |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
stop_puppetmaster() { |
|---|
| 33 |
for pmp in $PUPPETMASTERPORTS; do |
|---|
| 34 |
start-stop-daemon --stop --quiet --pidfile /var/run/puppet/$NAME.$pmp.pid |
|---|
| 35 |
done |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
case "$1" in |
|---|
| 39 |
start) |
|---|
| 40 |
log_begin_msg "Starting $DESC" |
|---|
| 41 |
start_puppetmaster |
|---|
| 42 |
log_end_msg $? |
|---|
| 43 |
;; |
|---|
| 44 |
stop) |
|---|
| 45 |
log_begin_msg "Stopping $DESC" |
|---|
| 46 |
stop_puppetmaster |
|---|
| 47 |
log_end_msg $? |
|---|
| 48 |
;; |
|---|
| 49 |
reload) |
|---|
| 50 |
# Do nothing, as Puppetmaster rechecks its config automatically |
|---|
| 51 |
;; |
|---|
| 52 |
restart|force-reload) |
|---|
| 53 |
log_begin_msg "Restarting $DESC" |
|---|
| 54 |
stop_puppetmaster |
|---|
| 55 |
sleep 1 |
|---|
| 56 |
start_puppetmaster |
|---|
| 57 |
log_end_msg 0 |
|---|
| 58 |
;; |
|---|
| 59 |
*) |
|---|
| 60 |
echo "Usage: $0 {start|stop|restart|force-reload}" >&2 |
|---|
| 61 |
exit 1 |
|---|
| 62 |
;; |
|---|
| 63 |
esac |
|---|
| 64 |
|
|---|
| 65 |
exit 0 |
|---|