nut-debian/scripts/RedHat/upsmon.in
2010-03-26 00:20:59 +01:00

57 lines
1015 B
Bash

#!/bin/sh
#
# chkconfig: 2345 31 89
#
# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
# start program as user nut
# new style stopping upsmon
# added reload option
#
# description: upsmon talks to upsd and notifies of ups status changes \
# also shutting systems down if required.
# processname: upsmon
# config: @sysconfdir@/upsmon.conf
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/ups ]; then
. /etc/sysconfig/ups
else
POWERDOWNFLAG=/etc/killpower
NUTUSER=nutmon
fi
# See how we are called.
case "$1" in
start)
action "NUT Starting UPS monitor" upsmon -u $NUTUSER
touch /var/lock/subsys/upsmon
;;
stop)
action "NUT Stopping UPS monitor: " \
upsmon -c stop
rm -f /var/lock/subsys/upsmon
;;
restart)
$0 stop
$0 start
;;
reload)
action "NUT Reloading UPS monitor: " \
upsmon -c reload
;;
status)
status upsmon
;;
*)
echo "Usage: upsmon {start|stop|restart|reload|status}"
exit 1
esac