aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nut/upsmon.initd
diff options
context:
space:
mode:
authorValery Kartel <valery.kartel@gmail.com>2016-06-13 17:29:29 +0300
committerBartłomiej Piotrowski <b@bpiotrowski.pl>2016-07-07 11:38:04 +0200
commite409857fde32cd84d3f9de1c169336ee0d071e92 (patch)
treeb8920ba6373b1a4b909d43d1236f131acf4f1c7c /testing/nut/upsmon.initd
parentf1ec1ed9cc65d443bd48756b40eff58466c87b80 (diff)
downloadaports-e409857fde32cd84d3f9de1c169336ee0d071e92.tar.bz2
aports-e409857fde32cd84d3f9de1c169336ee0d071e92.tar.xz
testing/nut: Upgrade to 2.7.4. conf.d & init.d cleanups
- rename all /etc/nut/*.conf.sample to /etc/nut/*.conf - make conf.d/* init.d/* more clean and openrc-run'ed - nut-upsmon now dynamically depends on nut-upsd if the MODE parameter in /etc/nut/nut.conf is set to 'standalone' or 'netserver'. - make a user and group creation in pre-install. I think we need to remove this user/group from alpine-baselayout.
Diffstat (limited to 'testing/nut/upsmon.initd')
-rw-r--r--testing/nut/upsmon.initd34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/nut/upsmon.initd b/testing/nut/upsmon.initd
new file mode 100644
index 0000000000..468e514111
--- /dev/null
+++ b/testing/nut/upsmon.initd
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+
+name=nut-monitor
+pidfile=/var/run/upsmon.pid
+command=/usr/sbin/upsmon
+required_files="/etc/nut/nut.conf /etc/nut/upsmon.conf"
+extra_started_commands="reload"
+
+depend() {
+ use net
+ . /etc/nut/nut.conf
+ case $MODE in
+ standalone|netserver)
+ need nut-upsd
+ ;;
+ esac
+}
+
+start_pre() {
+ . /etc/nut/nut.conf
+ case $MODE in
+ none)
+ eerror "$name disabled, please adjust the configuration to your needs"
+ eerror "Then set MODE to a suitable value in /etc/nut/nut.conf to enable it"
+ return 1
+ ;;
+ esac
+}
+
+reload() {
+ ebegin "Reloading $name"
+ start-stop-daemon --signal HUP --pidfile ${pidfile}
+ eend $?
+}