4
# nut-upsmon: NUT ups monitor start-up and shutdown script
8
# 0 = success; causes "OK" to show up in checklist.
9
# 1 = failure; causes "FAIL" to show up in checklist.
10
# 2 = skip; causes "N/A" to show up in the checklist.
11
# Use this value if execution of this script is overridden
12
# by the use of a control variable, or if this script is not
13
# appropriate to execute for some other reason.
14
# 3 = reboot; causes the system to be rebooted after execution.
17
# stdin is redirected from /dev/null
19
# stdout and stderr are redirected to the /etc/rc.log file
20
# during checklist mode, or to the console in raw mode.
24
PATH=/usr/sbin:/usr/bin:/sbin
27
WHAT='NUT UPS monitor (Network UPS Tools -- http://www.exploits.org/nut)'
28
WHAT_PATH=/opt/nut/sbin/upsmon
29
WHAT_CONFIG=/etc/rc.config.d/nut-upsmon
31
# NOTE: If your script executes in run state 0 or state 1, then /usr might
32
# not be available. Do not attempt to access commands or files in
33
# /usr unless your script executes in run state 2 or greater. Other
34
# file systems typically not mounted until run state 2 include /var
39
# Check the exit value of a command run by this script. If non-zero, the
40
# exit code is echoed to the log file and the return value of this script
41
# is set to indicate failure.
47
rval=1 # script FAILed
61
if [ -f $WHAT_CONFIG ] ; then
64
echo "ERROR: $WHAT_CONFIG defaults file MISSING"
68
if [ "$NUT_START" -eq 1 -a -x $WHAT_PATH ]; then
69
$WHAT_PATH $UPSMON_ARGS && echo $WHAT $UPSMON_ARGS started
82
echo "Unable to stop $WHAT"
87
echo "usage: $0 {start|stop|start_msg|stop_msg}"