ports/sysutils/nut/files/nut.sh.in
Ion-Mihai Tetcu 1a36a781f4 Update to 2.6.1. Main changes:
- IPv6 always compiled in (drop IPV6 option)
- megatec and megatec_usb drivers replaced by blazer_ser and blazer_usb.
- liebertgxt2 renamed to liebert-esp2
- s/PREFIX/LOCALBASE/ for gd includes/libs (grrr!)
- add OPTIONal bash completion

PR:		152866 [1], 157925 [2],
Submitted by:	John Bayly <freebsd.ports@tipstrade.net> [1], lev@ [2]
2011-08-02 17:05:43 +00:00

50 lines
886 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nut
# REQUIRE: NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
# Define these nut_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/nut
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
nut_enable=${nut_enable-"NO"}
nut_prefix=${nut_prefix-"%%PREFIX%%"}
. /etc/rc.subr
name="nut"
rcvar=`set_rcvar`
load_rc_config $name
required_dirs="%%STATEDIR%%"
required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users"
command="${nut_prefix}/sbin/upsd"
pidfile="%%STATEDIR%%/upsd.pid"
start_precmd="nut_prestart"
stop_postcmd="nut_poststop"
nut_prestart() {
${nut_prefix}/libexec/nut/upsdrvctl start
}
nut_poststop() {
${nut_prefix}/libexec/nut/upsdrvctl stop
}
extra_commands=reload
reload()
{
kill -HUP `cat $pidfile`
}
run_rc_command "$1"