aboutsummaryrefslogtreecommitdiffstats
path: root/main/dnsmasq/dnsmasq.initd
blob: 4e035c2dd906aa798ce9824db9fec1609869d5cc (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
#!/sbin/openrc-run

description="A lightweight DNS, DHCP, RA, TFTP and PXE server"

extra_started_commands="reload"
description_reload="Clear cache and reload hosts files"

command="/usr/sbin/dnsmasq"
# Tell dnsmasq to not create pidfile, that's responsibility of init system.
command_args="-k --pid-file= $DNSMASQ_OPTS"
command_background="yes"
pidfile="/run/dnsmasq.pid"

depend() {
	provide dns
	need localmount net
	after bootmisc
	use logger
}

start_pre() {
	checkpath -m 0644 -o dnsmasq:dnsmasq -f /var/lib/misc/dnsmasq.leases
}

reload() {
	ebegin "Reloading $SVCNAME"
	kill -HUP "$(cat $pidfile)"
	eend $?
}