#! /bin/sh
#
# chkconfig: 345 60 20
# description: The rwho protocol lets remote users get a list of all of \
#              the users logged into a machine running the rwho daemon \
#              (similiar to finger).
# processname: rwhod

### BEGIN INIT INFO
# Provides: rwho
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: Rwho daemon
# Description: The rwho protocol lets remote users get a list of all of
# the users logged into a machine running the rwho daemon
# (similiar to finger).
### END INIT INFO



# Get config.
. /etc/sysconfig/network

# Get functions
. /etc/rc.d/init.d/functions

# Check that networking is up.
if [ ${NETWORKING} = "no" ] ; then
	exit 0
fi

# See how we were called.
case "$1" in
  start)
	gprintf "Starting rwho services: "
	daemon rwhod -u daemon
	echo
	touch /var/lock/subsys/rwhod
	;;
  stop)
	gprintf "Stopping rwho services: "
	PID=`/sbin/pidof rwhod`
	if [ -n "$PID" ] ; then
		kill $PID
	fi
	echo
	rm -f /var/lock/subsys/rwhod
	;;
  status)
	status rwhod
	;;
  restart)
	$0 stop
	$0 start
	;;
  reload)
	gprintf "There is no way to reload rwhod as there isn't any config file.\n"
	;;
  *)
	gprintf "Usage: %s {start|stop|status|restart}\n" "$0"
	exit 1
	;;
esac

exit 0
