#!/bin/sh
#
# upsmon	NUT daemon monitoring tool
#
# chkconfig:	2345 10 90
#
# description:	upsmon talks to upsd and notifies of ups status changes,
#               also shutting systems down if required.
# processname:	upsmon
# config:	/etc/ups/

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

# Get network config
. /etc/sysconfig/network

# Get config.
[ -f /etc/sysconfig/upsmon ] && . /etc/sysconfig/upsmon

prog="UPS Monitor"

# See how we are called.
case "$1" in
  start)
	echo -n $"Starting $prog: "
	daemon upsmon
	[ "$?" -eq 0 ] && touch /var/lock/subsys/upsmon
	echo
	;;
  stop)
	echo -n $"Stopping $prog: "
	killproc upsmon
	rm -f /var/lock/subsys/upsmon
	echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  force-reload)
	$0 restart
	exit $?
	;;
  status)
	status upsmon
	exit $?
	;;
  *)
	msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
	exit 1
	;;
esac 
