#!/bin/sh
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.org>.
# Modified for Debian by Christoph Lameter <clameter@debian.org>

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/venus
NAME="venus"
DESC="Coda client"
SERVER="coda-client"

FLAGS="defaults 50"

test -f $DAEMON || exit 0

case "$1" in
	start)
	echo -n "Starting $DESC: "
		start-stop-daemon --start --quiet --pidfile /var/run/$SERVER.pid \
			--background --exec $DAEMON
	echo "$NAME."
    ;;
	stop)
	echo -n "Stopping $DESC: "
    	start-stop-daemon --stop --quiet --pidfile /var/run/$SERVER.pid \
			--exec $DAEMON
    	umount -a -t coda
	echo "$NAME."
	;;
	restart|force-reload)
	#
	# If the "reload" option is implemented, move the "force-reload"
	# option to the "reload" entry above. If not, "force-reload" is
	# just the same as "restart".
	#
		echo -n "Restarting $DESC: "
		start-stop-daemon --stop --quiet --pidfile /var/run/$SERVER.pid \
			--exec $DAEMON
		umount -a -t coda
		sleep 1
		start-stop-daemon --start --quiet --pidfile /var/run/$SERVER.pid \
			--background --exec $DAEMON
		echo "$NAME."
	;;
	*)
		echo "Usage: /etc/init.d/coda-client {start|stop|restart|force-reload}"
		exit 1
	;;
esac

exit 0
