#!/bin/sh -e

### BEGIN INIT INFO
# Provides:          rwhod
# Required-Start:    $network $local_fs
# Required-Stop:     $network $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Server for rwho and ruptime services
### END INIT INFO

# rwhod		Startup script for the rwhod server.
#
#		Modified for rwhod
#		by Herbert Xu <herbert@debian.org>
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#               Improved for option handling and LSB compliance
#               by Alberto Gonzalez Iniesta <agi@inittab.org>
#
# Version:	$Id: rwhod.init,v 1.5 2000/07/18 12:25:51 herbert Exp $

test $DEBIAN_SCRIPT_DEBUG && set -v -x

DESC="System status server"
DAEMON="/usr/sbin/rwhod"
CONF_FILE="/etc/default/rwhod"
# default options. Change them in /etc/default/rwhod
RWHOD_OPTIONS="-b"

test -x $DAEMON || exit 0
if test -e $CONF_FILE ; then
	. $CONF_FILE
fi

start_stop() {
	case "$1" in
	start)
		printf "Starting $DESC:"
		start-stop-daemon --start --oknodo --quiet \
				  --exec $DAEMON -- $RWHOD_OPTIONS
		printf " rwhod"
		printf ".\n"
		;;
	stop)
		printf "Stopping $DESC:"
		start-stop-daemon --stop --oknodo --quiet \
				  --exec $DAEMON
		printf " rwhod"
		printf ".\n"
		;;
	restart | force-reload)
		start_stop stop
		sleep 1
		start_stop start
		;;
	*)
		printf "Usage: $0 {start|stop|restart|force-reload}\n" >&2
		exit 1
		;;
	esac
}

start_stop "$@"

exit 0
