diff --git a/conf/redhat/server.init b/conf/redhat/server.init index 5505058ed..4f4420683 100644 --- a/conf/redhat/server.init +++ b/conf/redhat/server.init @@ -1,136 +1,137 @@ #!/bin/bash # puppetmaster This shell script enables the puppetmaster server. # # Authors: Duane Griffin # Peter Meier (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/puppetmasterd.pid # Source function library. . /etc/rc.d/init.d/functions if [ -f /etc/sysconfig/puppetmaster ]; then . /etc/sysconfig/puppetmaster fi PUPPETMASTER_OPTS="" [ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="--manifest=${PUPPETMASTER_MANIFEST}" if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then PUPPETMASTER_OPTS="$PUPPETMASTER_OPTS --servertype=mongrel" elif [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -eq 1 ]; then PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --masterport=${PUPPETMASTER_PORTS[0]}" fi [ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest ${PUPPETMASTER_LOG}" PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \ ${PUPPETMASTER_EXTRA_OPTS}" RETVAL=0 prog=puppetmasterd PUPPETMASTER=/usr/sbin/$prog start() { echo -n $"Starting puppetmaster: " # Confirm the manifest exists if [ -r $PUPPETMASTER_MANIFEST ]; then if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do echo -en "\nPort: ${PUPPETMASTER_PORTS[$i]}" daemon $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]} --pidfile=/var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid ret=$?; [ $ret != 0 ] && RETVAL=$ret done else daemon $PUPPETMASTER $PUPPETMASTER_OPTS RETVAL=$? fi 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: " if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do echo -en "\nPort: ${PUPPETMASTER_PORTS[$i]}" killproc -p /var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid puppetmaster ret=$?; [ $ret != 0 ] && RETVAL=$ret done else killproc | grep -q -- '-p' 2>/dev/null && killopts="-p $pidfile" killproc $killopts $PUPPETMASTER RETVAL=$? fi echo [ $RETVAL -eq 0 ] && rm -f "$lockfile" return $RETVAL } restart() { stop start } genconfig() { echo -n $"Generate configuration puppetmaster: " $PUPPETMASTER $PUPPETMASTER_OPTS --genconfig } rh_status() { if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do echo -en "Port ${PUPPETMASTER_PORTS[$i]}: " status -p /var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid puppetmaster ret=$?; [ $ret != 0 ] && RETVAL=$ret done else status $PUPPETMASTER RETVAL=$? fi 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