File chef-client.init of Package rubygem-chef
#!/bin/bash
#
# chef-client Startup script for the Chef client
#
# chkconfig: - 98 02
# description: Client component of the Chef systems integration framework.
### BEGIN INIT INFO
# Provides: chef-client
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Should-Start: $named $time
# Should-Stop: $named $time
# Short-Description: Startup script for the Chef client
# Description: Client component of the Chef systems integration framework.
### END INIT INFO
# Source function library
. /etc/rc.status
exec="/usr/bin/chef-client"
prog="chef-client"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
config=${CONFIG-/etc/chef/client.rb}
pidfile=${PIDFILE-/var/run/chef/client.pid}
lockfile=${LOCKFILE-/var/lock/subsys/$prog}
logfile=${LOGFILE-/var/log/chef/client.log}
interval=${INTERVAL-900}
splay=${SPLAY-20}
options=${OPTIONS-}
case "$1" in
start)
echo -n $"Starting $prog: "
if [ ! -d /var/run/chef ]; then
mkdir -p /var/run/chef
chmod 0750 /var/run/chef
chown chef:chef /var/run/chef
fi
startproc -w -q $exec -d -c "$config" -L "$logfile" -P "$pidfile" -i "$interval" -s "$splay" $options
# It's possible for startproc to return success before chef-client
# has daemonized. It's also possible for startproc to return success
# even if chef-client will fail (e.g.: log path not writable), so
# we give it a few seconds to actually get underway...
for i in 1 2 3 4 5 ; do
sleep 1
rc_reset
checkproc -p $pidfile $prog
rc_status && break
done
rc_status -v
;;
stop)
echo -n $"Stopping $prog: "
killproc $exec -p "$pidfile"
rc_status -v
;;
restart)
$0 stop
$0 start
;;
reload)
;;
force-reload)
force_reload
;;
status)
echo -n $"Checking $prog: "
checkproc -p $pidfile $prog
rc_status -v
;;
condrestart|try-restart)
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?