summaryrefslogtreecommitdiffstats
path: root/testing/vnstat/vnstatd.initd
blob: 167e2cc3072f171b739f3064f62cbe1097bc0f1a (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
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

extra_started_commands="reload"

depend() {
	use net
}

VNSTATD_PIDFILE="${VNSTATD_PIDFILE:-/var/run/vnstatd/vnstatd.pid}"

start() {
	ebegin "Starting vnstatd"
	checkpath -q -d -m 755 -o vnstat:vnstat /var/run/vnstatd
	start-stop-daemon --start --quiet \
		--pidfile "${VNSTATD_PIDFILE}" \
		--user vnstat --group vnstat \
		--nicelevel ${VNSTATD_NICELEVEL:-0} \
		--exec /usr/sbin/vnstatd -- \
		-d ${VNSTATD_EXTRAOPTS} -p ${VNSTATD_PIDFILE}
	eend $?
}

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

reload() {
	ebegin "Reloading vnstatd configuration"
	kill -HUP $(< "${VNSTATD_PIDFILE}") &>/dev/null
	eend $?
}