Created
November 25, 2009 19:17
-
-
Save damm/242948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Startup script for chef-client | |
# | |
# chkconfig: - 98 02 | |
# description: Client component of the Chef systems integration framework. | |
# processname: chef-client | |
# | |
# config: /etc/sysconfig/chef-client | |
# pidfile: /var/run/chef/chef-client.pid | |
# Source function library | |
. /etc/init.d/functions | |
[ -f /etc/sysconfig/chef-client ] && . /etc/sysconfig/chef-client | |
prog="chef-client" | |
pidfile=${PIDFILE-/var/run/chef/client.pid} | |
lockfile=${LOCKFILE-/var/lock/subsys/$prog} | |
config=${CONFIG-/etc/chef/client.rb} | |
user=${USER-root} | |
group=${GROUP-root} | |
interval=${INTERVAL-1800} | |
splay=${SPLAY-20} | |
logfile=${LOGFILE-/var/log/chef/client.log} | |
options=${OPTIONS-} | |
start() { | |
echo -n "Starting $prog:" | |
daemon chef-client -d -c "$config" -i "$interval" -s "$splay" -L "$logfile" "$options" "&>/dev/null" | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && touch ${lockfile} | |
return $RETVAL | |
} | |
stop() { | |
echo -n "Stopping $prog: " | |
if [ -f $pidfile ]; then | |
killproc chef-client | |
RETVAL=$? | |
if [ $RETVAL -ne 0 ]; then | |
failure; | |
fi; | |
else | |
RETVAL=1 | |
failure; | |
fi | |
rm -f $lockfile | |
echo | |
return $RETVAL | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
sleep 2 | |
start | |
;; | |
condrestart) | |
if [ -f $lockfile ]; then | |
stop | |
start | |
fi | |
;; | |
status) | |
status chef-client | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|condrestart|status}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment