mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-09 15:27:06 +02:00
54 lines
1.1 KiB
Plaintext
54 lines
1.1 KiB
Plaintext
#!/sbin/runscript
|
|
|
|
extra_started_commands="reload"
|
|
|
|
pid_dir=/var/run/nut
|
|
pidfile=/var/run/nut/upsd.pid
|
|
upsd=/usr/sbin/upsd
|
|
upsdrvctl=/usr/libexec/nut/upsdrvctl
|
|
NAME=nut-server
|
|
|
|
depend() {
|
|
use net
|
|
before nut-upsmon
|
|
}
|
|
|
|
start_pre()
|
|
{
|
|
# Ensure that our dirs are correct
|
|
checkpath -d --owner root:nut --mode 0770 $pid_dir
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting upsd"
|
|
|
|
# Include NUT nut.conf
|
|
[ -r $CONFIG ] && . $CONFIG
|
|
|
|
# Explicitly require the configuration to be done in /etc/nut/nut.conf
|
|
# redundant with nut-client
|
|
if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
|
|
eerror "$NAME disabled, please adjust the configuration to your needs"
|
|
eerror "Then set MODE to a suitable value in $CONFIG to enable it"
|
|
# exit success to avoid breaking the install process!
|
|
return 1
|
|
fi
|
|
|
|
${upsdrvctl} -u nut start &>/dev/null
|
|
start-stop-daemon --start --pidfile ${pidfile} --exec ${upsd} -- ${ARGS}
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping upsd"
|
|
start-stop-daemon --stop --pidfile ${pidfile}
|
|
${upsdrvctl} -u nut stop &>/dev/null
|
|
eend $?
|
|
}
|
|
|
|
reload() {
|
|
ebegin "Reloading upsd"
|
|
start-stop-daemon --stop --signal HUP --pidfile ${pidfile}
|
|
eend $?
|
|
}
|