c-icap/c-icap-initscript

78 lines
1.5 KiB
Bash

#!/bin/sh
#
# chkconfig: 345 92 34
# description: Starts and stops the c-icap server
#
# pidfile: /var/run/c-icap/c-icap.pid
# config: /etc/c-icap.conf
# source function library
. /etc/sysconfig/rc
. $rc_functions
NAME=c-icap
DAEMON=/usr/bin/$NAME
DAEMONPID=/var/run/c-icap/$NAME.pid
DAEMONCONF=/etc/c-icap.conf
OPTIONS=""
[ -x $DAEMON ] || exit 0
# source networking configuration
. /etc/sysconfig/network
# check that networking is up
[ ${NETWORKING} = "no" ] && exit 0
# avoid using root's TMPDIR
unset TMPDIR
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
# check that smb.conf exists
[ -r $DAEMONCONF ] || exit 0
RETVAL=0
case "$1" in
start)
echo -n $"Starting $NAME: "
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
;;
stop)
echo -n $"Stopping $NAME: "
killproc -p $DAEMONPID $DAEMON
# Workaround: force stop of all processes
killall -9 $DAEMON
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
reload)
echo -n "Reloading $NAME: "
reloadproc $DAEMON
echo
;;
condrestart)
[ -e /var/lock/subsys/$NAME ] && $0 restart || :
;;
status)
statusproc $DAEMON
RETVAL=$?
;;
*)
echo $"Usage: ""/etc/init.d/$NAME {start|stop|status|reload|restart|condrestart}"
exit 1
;;
esac
exit $?