blob: c34182b321d7822a60065dbfd88f008143034b22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#!/bin/bash
# puppetmaster This shell script enables the puppetmaster server.
#
# Authors: Duane Griffin <d.griffin@psenterprise.com>
# Peter Meier <peter.meier@immerda.ch> (Mongrel enhancements)
#
# chkconfig: - 65 45
#
# description: Server for the puppet system management tool.
# processname: puppetmaster
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
lockfile=/var/lock/subsys/puppetmaster
pidfile=/var/run/puppet/master.pid
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/puppetmaster ]; then
. /etc/sysconfig/puppetmaster
fi
PUPPETMASTER_OPTS="master "
[ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --manifest=${PUPPETMASTER_MANIFEST}"
[ -n "$PUPPETMASTER_PORTS" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --masterport=${PUPPETMASTER_PORTS[0]}"
[ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest ${PUPPETMASTER_LOG}"
PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \
${PUPPETMASTER_EXTRA_OPTS}"
# Determine if we can use the -p option to daemon, killproc, and status.
# RHEL < 5 can't.
if status | grep -q -- '-p' 2>/dev/null; then
daemonopts="--pidfile $pidfile"
pidopts="-p $pidfile"
fi
mongrel_warning="The mongrel servertype is no longer built-in to Puppet. It appears
as though mongrel is being used, as the number of ports is greater than
one. Starting the puppetmaster service will not behave as expected until this
is resolved. Only the first port has been used in the service. These settings
are defined at /etc/sysconfig/puppetmaster"
# Warn about removed and unsupported mongrel servertype
if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
echo $mongrel_warning
echo
fi
RETVAL=0
PUPPETMASTER=/usr/bin/puppet
start() {
echo -n $"Starting puppetmaster: "
# Confirm the manifest exists
if [ -r $PUPPETMASTER_MANIFEST ]; then
daemon $daemonopts $PUPPETMASTER $PUPPETMASTER_OPTS
RETVAL=$?
else
failure $"Manifest does not exist: $PUPPETMASTER_MANIFEST"
echo
return 1
fi
[ $RETVAL -eq 0 ] && touch "$lockfile"
echo
return $RETVAL
}
stop() {
echo -n $"Stopping puppetmaster: "
killproc $pidopts $PUPPETMASTER
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f "$lockfile"
return $RETVAL
}
restart() {
stop
start
}
genconfig() {
echo -n $"Generate configuration puppetmaster: "
$PUPPETMASTER $PUPPETMASTER_OPTS --genconfig
}
rh_status() {
status $pidopts $PUPPETMASTER
RETVAL=$?
return $RETVAL
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart)
rh_status_q || exit 0
restart
;;
status)
rh_status
;;
genconfig)
genconfig
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|genconfig}"
exit 1
esac
exit $RETVAL
# vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab
|