summaryrefslogtreecommitdiff
path: root/sysutils/nut/files/nut.in
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2012-08-05 23:19:36 +0000
committerDoug Barton <dougb@FreeBSD.org>2012-08-05 23:19:36 +0000
commit9aac569eaa031e27191a3f4165b389a17f467ad2 (patch)
tree1ed78841e1757014ccc09581c61c3683992d3f77 /sysutils/nut/files/nut.in
parentWhen installing in the base, USE_RCORDER does the right thing without (diff)
Move the rc.d scripts of the form *.sh.in to *.in
Where necessary add $FreeBSD$ to the file No PORTREVISION bump necessary because this is a no-op
Diffstat (limited to 'sysutils/nut/files/nut.in')
-rw-r--r--sysutils/nut/files/nut.in50
1 files changed, 50 insertions, 0 deletions
diff --git a/sysutils/nut/files/nut.in b/sysutils/nut/files/nut.in
new file mode 100644
index 000000000000..98ba6394389c
--- /dev/null
+++ b/sysutils/nut/files/nut.in
@@ -0,0 +1,50 @@
+#!/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=nut_enable
+
+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"