#!/bin/sh # # c-icap This shell script takes care of starting and stopping # c-icap ICAP server # # chkconfig: 345 90 10 # # description: c-icap ICAP server # # processname: c-icap # pidfile: /var/run/c-icap/c-icap.pid # config: /etc/c-icap/c-icap.conf # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/c-icap ] && . /etc/sysconfig/c-icap # Default pidfile location c_icap_pidfile="/var/run/c-icap/c-icap.pid" # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then msg_network_down c-icap exit 1 fi else exit 0 fi start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/c-icap ]; then msg_starting c-icap daemon /usr/bin/c-icap RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/c-icap else msg_already_running c-icap fi } stop() { if [ -f /var/lock/subsys/c-icap ]; then # Stop daemons. msg_stopping c-icap killproc --pidfile $c_icap_pidfile c-icap rm -f /var/lock/subsys/c-icap >/dev/null 2>&1 else msg_not_running c-icap fi } restart() { # if service is up, do configtest if [ -f /var/lock/subsys/c-icap ]; then if [ $RETVAL != 0 ]; then exit 1 fi fi stop start } condrestart() { # if service is up, do configtest if [ -f /var/lock/subsys/c-icap ]; then if [ $RETVAL != 0 ]; then exit 1 fi stop start else msg_not_running c-icap RETVAL=0 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; try-restart) condrestart ;; reload|force-reload) reload ;; status) status --pidfile $c_icap_pidfile c-icap exit $? ;; *) msg_usage "$0 {start|stop|init|restart|try-restart|reload|force-reload|status}" exit 3 esac exit $RETVAL