aboutsummaryrefslogtreecommitdiff
path: root/sysutils/nut22/files/nut.sh.in
blob: 9cd40c1430b56f612070b7996dc1b19a50c87abc (plain) (blame)
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
#!/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%%"}

. %%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
}

run_rc_command "$1"