summaryrefslogtreecommitdiffstats
path: root/source/n/dnsmasq/rc.dnsmasq
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/dnsmasq/rc.dnsmasq')
-rw-r--r--source/n/dnsmasq/rc.dnsmasq9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/n/dnsmasq/rc.dnsmasq b/source/n/dnsmasq/rc.dnsmasq
index ce584cbd2..f19a17239 100644
--- a/source/n/dnsmasq/rc.dnsmasq
+++ b/source/n/dnsmasq/rc.dnsmasq
@@ -11,7 +11,14 @@ dnsmasq_start() {
# Stop dnsmasq:
dnsmasq_stop() {
- killall dnsmasq
+ # Try to use the .pid file first:
+ if pgrep -l -F /var/run/dnsmasq.pid 2> /dev/null | grep -q dnsmasq ; then
+ echo "Stopping dnsmasq."
+ pkill -F /var/run/dnsmasq.pid 2> /dev/null
+ else # kill any dnsmasq processes in this namespace:
+ echo "Stopping dnsmasq."
+ killall --ns $$ dnsmasq 2> /dev/null
+ fi
}
# Restart dnsmasq: