summaryrefslogtreecommitdiff
path: root/sys-power/nut/files/nut-2.8.0-init.d-upsd
blob: ce09de52d56d6ab39f476c740431210a3cdcf911 (plain)
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
#!/sbin/openrc-run
# Copyright 1999-2023 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

extra_started_commands="reload"

pidfile=/run/nut/upsd.pid
bin=/usr/sbin/upsd

depend() {
	use net
	before upsmon
	after upsdrv
}

start() {
	ebegin "Starting upsd"
	# clean up first
	pkill -u root,nut -x ${bin}
	sleep 1
	rm -f ${pidfile}
	# now start up
	start-stop-daemon --start --quiet --exec ${bin}
	eend $?
}

stop() {
	ebegin "Stopping upsd"
	start-stop-daemon --stop --quiet --pidfile ${pidfile}
	eend $?
}

reload() {
	ebegin "Reloading upsd"
	start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
	eend $?
}