#!/bin/sh
# chkconfig: - 96 01
# description: The Coda File Server
# Source function library.
. /etc/rc.d/init.d/functions
exec=/usr/sbin/startserver
prog=codasrv
pidfile=/vice/srv/pid
config=/etc/coda/server.conf
lockfile=/var/lock/subsys/$prog
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
if [ ! -f /vice/srv/CRASH ]; then
daemon --pidfile=$pidfile $exec
retval=$?
else
echo "`date`: "$"found CRASH file, srv not started" >> /vice/srv/SrvErr
echo $"found CRASH file, srv not started"
failure $"found CRASH file, srv not started"
retval=1
fi
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
# original codasrv script has a hardstop, not needed as killproc will wait
# for the process to die and if it doesn't switch to using kill -9 itself
stop|hardstop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
echo $"$1 not available"
exit 3
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?