aports/testing/nut/upsd.initd
Valery Kartel e409857fde 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.
2016-07-07 11:38:04 +02:00

40 lines
745 B
Plaintext

#!/sbin/openrc-run
name=nut-server
pidfile=/var/run/nut/upsd.pid
command=/usr/sbin/upsd
required_files="/etc/nut/nut.conf /etc/nut/upsd.conf"
extra_started_commands="reload"
depend() {
use net
}
start_pre() {
. /etc/nut/nut.conf
case $MODE in
standalone|netserver)
checkpath -d --owner nut:nut --mode 750 ${pidfile%/*} || return 1
/usr/sbin/upsdrvctl start > /dev/null
;;
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
;;
*)
return 1
;;
esac
}
stop_post() {
/usr/sbin/upsdrvctl stop > /dev/null
}
reload() {
ebegin "Reloading $name"
start-stop-daemon --signal HUP --pidfile ${pidfile}
eend $?
}