#!/bin/bash # Startup script for chef-indexer. # # chkconfig: - 75 25 # description: Server component of the Chef systems integration framework. # processname: chef-indexer # # config: /etc/sysconfig/chef-indexer # pidfile: /var/run/chef/chef-indexer.pid # Source function library . /etc/init.d/functions [ -f /etc/sysconfig/chef-indexer ] && . /etc/sysconfig/chef-indexer prog="chef-indexer" pidfile=${PIDFILE-/var/run/chef/indexer.pid} lockfile=${LOCKFILE-/var/lock/subsys/$prog} config=${CONFIG-/etc/chef/indexer.rb} user=${USER-chef} group=${GROUP-chef} logfile=${LOGFILE-/var/log/chef/indexer.log} options=${OPTIONS-} start() { echo -n "Starting $prog:" daemon chef-indexer -d -c "$config" -u "$user" -g "$group" -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-indexer 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 start ;; condrestart) if [ -f $lockfile ]; then stop start fi ;; status) status chef-indexer ;; *) echo "Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL