pkgsrc-wip/ups-nut/files/ups.sh
Jason White ecd68ccce4 The primary goal of the Network UPS Tools (NUT) project is to provide
reliable monitoring of UPS hardware and ensure safe shutdowns of the
systems which are connected.

Network communications are used so that multiple systems can monitor a
single physical UPS and shut down together if necessary without any
special "sharing hardware" on the UPS itself.
2008-02-01 03:23:42 +00:00

55 lines
921 B
Bash

#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: ups.sh,v 1.1.1.1 2008/02/01 03:23:42 jdwhite Exp $
#
# KEYWORD: nostart
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
rcd_dir=`@DIRNAME@ $0`
# NOTE: run_rc_command sets $rc_arg
#
forward_commands()
{
# Backward compat with NetBSD <1.6:
[ -z "$rc_arg" ] && rc_arg=$_arg
for file in $COMMAND_LIST; do
$rcd_dir/$file $rc_arg
done
}
reverse_commands()
{
# Backward compat with NetBSD <1.6:
[ -z "$rc_arg" ] && rc_arg=$_arg
REVCOMMAND_LIST=
for file in $COMMAND_LIST; do
REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
done
for file in $REVCOMMAND_LIST; do
$rcd_dir/$file $rc_arg
done
}
COMMAND_LIST="upsdriver upsd upsmon upslog"
name="ups"
start_cmd="forward_commands"
stop_cmd="reverse_commands"
status_cmd="forward_commands"
extra_commands="status"
if [ -f /etc/rc.subr ]
then
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
_arg="$1"
${start_cmd}
fi