summarylogtreecommitdiffstats
path: root/dnss.service
blob: 98e042f74b29a02109f1f0d245b2098fe8185b70 (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
#!/sbin/openrc-run

command="/usr/bin/dnss"
command_args="-c /etc/dnss.conf"
pidfile="/run/${RC_SVCNAME}.pid"
command_background=true
output_log="/var/log/dnss/${RC_SVCNAME}.log"
error_log="/var/log/dnss/${RC_SVCNAME}.err"

depend() {
	provide dns
	use net
}

start_pre() {
	# Create log directory if needed
	checkpath -d -m 755 -o "${command_user}" /var/log/dnss
}

stop() {
	ebegin "Stopping ${RC_SVCNAME}"

	# Graceful shutdown: TERM -> wait 5s -> KILL if still running
	start-stop-daemon --stop \
		--pidfile "${pidfile}" \
		--retry TERM/5/KILL/5 \
		--exec "${command}"

	eend $?
}