#!/bin/sh
#
# chkconfig: 2345 31 89
# description: upsmon talks to upsd and notifies of ups status changes \
#	also shutting systems down if required.
# processname: upsmon
# config: /etc/ups/upsmon.conf

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

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


# See how we are called.
case "$1" in
  start)
	action "NUT Starting UPS monitor" upsmon
	touch /var/lock/subsys/upsmon
	;;
  stop)
	gprintf "NUT Stopping UPS monitor: "
	killproc upsmon
	echo ""
	rm -f /var/lock/subsys/upsmon
	;;
  restart)
	$0 stop
	$0 start
	;;
  reload)
  	gprintf "NUT Reload UPS monitor: "
        killproc upsmon -1
        echo ""
  	;;
  status)
	status upsmon
	;;
  *)
	gprintf "Usage: upsmon {start|stop|restart|status|reload}\n"
	exit 1
esac

