summaryrefslogtreecommitdiffstats
path: root/sysutils/nut22/files/nut.sh.sample
blob: 24945d485928ca793af0c6c073e27596f49fbc5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/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%%"}
nut_pidfile=${nut_pidfile-"/var/db/nut/nut.pid"}
nut_upslog=${nut_upslog-"/var/log/ups.log"}
nut_upsloginterval=${nut_upsloginterval-"300"}
nut_upslogmail=${nut_upslogmail-"backups@localhost"}

. %%RC_SUBR%%

name="nut"
rcvar=`set_rcvar`

start_cmd="nut_start"
stop_cmd="nut_stop"

nut_start() {
	${nut_prefix}/libexec/nut/upsdrvctl start
	${nut_prefix}/sbin/upsd
	${nut_prefix}/sbin/upsmon localhost
	${nut_prefix}/bin/upslog -s ${nut_upslogmail} -l ${nut_upslog} -i ${nut_upsloginterval}
}

nut_stop() {
	/usr/bin/killall upslog upsmon upsd
	${nut_prefix}/libexec/nut/upsdrvctl stop
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud