aboutsummaryrefslogtreecommitdiffstats
path: root/main/dnsmasq/dnsmasq.initd
diff options
context:
space:
mode:
Diffstat (limited to 'main/dnsmasq/dnsmasq.initd')
-rw-r--r--main/dnsmasq/dnsmasq.initd33
1 files changed, 12 insertions, 21 deletions
diff --git a/main/dnsmasq/dnsmasq.initd b/main/dnsmasq/dnsmasq.initd
index 0ebcb3cfc6..4e035c2dd9 100644
--- a/main/dnsmasq/dnsmasq.initd
+++ b/main/dnsmasq/dnsmasq.initd
@@ -1,12 +1,15 @@
#!/sbin/openrc-run
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/files/dnsmasq-init-r1,v 1.2 2011/12/04 10:28:47 swegener Exp $
-description="Lightweight DNS, TFTP, PXE, router advertisement and DHCP server"
-description_reload="Clear cache and reload hosts files"
+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
@@ -15,24 +18,12 @@ depend() {
use logger
}
-start() {
- ebegin "Starting ${SVCNAME}"
- start-stop-daemon --start --exec /usr/sbin/dnsmasq \
- --pidfile /var/run/dnsmasq.pid \
- -- -x /var/run/dnsmasq.pid ${DNSMASQ_OPTS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping ${SVCNAME}"
- start-stop-daemon --stop --exec /usr/sbin/dnsmasq \
- --pidfile /var/run/dnsmasq.pid
- eend $?
+start_pre() {
+ checkpath -m 0644 -o dnsmasq:dnsmasq -f /var/lib/misc/dnsmasq.leases
}
reload() {
- ebegin "Reloading ${SVCNAME}"
- start-stop-daemon --stop --oknodo --signal HUP \
- --exec /usr/sbin/dnsmasq --pidfile /var/run/dnsmasq.pid
+ ebegin "Reloading $SVCNAME"
+ kill -HUP "$(cat $pidfile)"
eend $?
}