#!/bin/sh
#
# mon   This shell script takes care of starting and stopping mon.
#
# chkconfig: 2345 99 10
# description: mon system monitoring daemon
# processname: mon
# config: /etc/mon/mon.cf
# config: /etc/mon/auth.cf
# pidfile: /var/run/mon.pid
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH

# Source function library.
. /etc/rc.d/init.d/functions

[ -x /usr/bin/mon ] || exit 0

# See how we were called.
case "$1" in
    start)
	echo -n "Starting mon daemon: "
	daemon /usr/bin/mon -f -l -c /etc/mon/mon.cf -f
	 RETVAL=$?
	echo
	touch /var/lock/subsys/mon
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mon
	;;
    stop)
	echo -n "Stopping mon daemon: "
	killproc mon
	 RETVAL=$?
	echo
	rm -f /var/lock/subsys/mon
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mon
	;;
    status)
    	status mon
	;;
    restart)
    	$0 stop
    	$0 start
	;;
    reload)
    	killall -HUP mon
	;;
    *)
    	echo "Usage: $0 {start|stop|status|restart|reload}"
	exit 1
esac

exit 0
