#!/bin/sh
# chkconfig: 345 97 01
# description: The Coda cache manager.
# Source function library.
. /etc/rc.d/init.d/functions
exec=/usr/sbin/venus
prog=coda-client
config=/etc/coda/venus.conf
lockfile=/var/lock/subsys/$prog
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
# coda-client specific settings
pid_file=/var/run/coda-client.pid
mountpoint=/coda
# which can be overridden from venus.conf
[ -x /usr/sbin/codaconfedit ] && . `/usr/sbin/codaconfedit venus.conf`
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
echo -n "kernel "
/sbin/modprobe coda
/sbin/udevsettle
echo -n "venus"
/usr/sbin/vutil --swaplogs >/dev/null 2>&1
daemon --pidfile=$pid_file "$exec >/dev/null 2>&1"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pid_file $prog
retval=$?
echo
if [ $retval -eq 0 ]; then
msg=$"Unmounting $mountpoint:"
echo -n "$msg"
umount $mountpoint
retval=$?
[ $retval -eq 0 ] && success "$msg" || failure "$msg"
echo
fi
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
rh_status() {
status -p $pid_file $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
# original venus 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|reload|force-reload|condrestart|try-restart)
echo $"$1 not available"
exit 3
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?