#!/bin/bash # # Init file for Puppet Client # author: Bryant Taylor jjast73@gmail.com # chkconfig: 2345 55 25 # description: Puppet Client # # processname: puppetd # pidfile: /var/puppet/run/puppetd.pid # source function library . /etc/rc.d/init.d/functions RETVAL=0 prog="puppetd" # Some functions to make the below more readable P_CLIENT=/usr/bin/puppetd PID_FILE=/var/puppet/run/puppetd.pid start() { echo -n $"Starting $prog: " $P_CLIENT && success || failure RETVAL=$? [ "$RETVAL" = 0 ] && touch /var/lock/subsys/puppetd echo } stop() { echo -n $"Stopping $prog: " RETVAL=$? killproc $P_CLIENT -TERM RETVAL=$? echo [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/puppetd echo } reload() { echo -n $"Reloading $prog: " if [ -n "`pidfileofproc $P_CLIENT`" ] ; then killproc $P_CLIENT -HUP else failure $"Reloading $prog" fi RETVAL=$? echo } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reload) reload ;; condrestart) if [ -f /var/lock/subsys/puppetd ] ; then if [ "$RETVAL" = 0 ] ; then stop # avoid race sleep 3 start fi fi ;; status) status $P_CLIENT RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac exit $RETVAL