Don't moan if dnsmasq has not written a pidfile.
authorRoy Marples <roy@marples.name>
Mon, 5 May 2014 22:18:15 +0000 (22:18 +0000)
committerRoy Marples <roy@marples.name>
Mon, 5 May 2014 22:18:15 +0000 (22:18 +0000)
dnsmasq.in

index 542acaa5b19d7813dfdd239f5015eb743e62680f..1b6ad16640c7562516ef4b1d1bdc87e56cb047af 100644 (file)
@@ -35,6 +35,7 @@ NL="
 
 : ${dnsmasq_pid:=/var/run/dnsmasq.pid}
 [ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
 
 : ${dnsmasq_pid:=/var/run/dnsmasq.pid}
 [ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
+[ -s "$dnsmasq_pid" ] || unset dnsmasq_pid
 : ${dnsmasq_service:=dnsmasq}
 : ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
 newconf="# Generated by resolvconf$NL"
 : ${dnsmasq_service:=dnsmasq}
 : ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
 newconf="# Generated by resolvconf$NL"
@@ -182,7 +183,9 @@ if $changed; then
        eval $dnsmasq_restart
 fi
 if $dbus; then
        eval $dnsmasq_restart
 fi
 if $dbus; then
-       $changed || kill -HUP $(cat "$dnsmasq_pid")
+       if [ -s "$dnsmasq_pid" ]; then
+               $changed || kill -HUP $(cat "$dnsmasq_pid")
+       fi
        # Send even if empty so old servers are cleared
        if $dbus_ex; then
                method=SetDomainServers
        # Send even if empty so old servers are cleared
        if $dbus_ex; then
                method=SetDomainServers