Improve the way we HUP dnsmasq (#953)

This commit is contained in:
Tim Wilkinson 2023-09-29 20:09:53 -07:00 committed by GitHub
parent a2e9e3054c
commit 880a4f195a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -149,10 +149,10 @@ end
function dns_update(reload)
if reload then
os.execute("/etc/init.d/dnsmasq restart")
else
local pid = capture("pidof dnsmasq")
if pid ~= "" then
nixio.kill(tonumber(pid), 1)
elseif nixio.fs.stat("/var/run/dnsmasq/dnsmasq.pid") then
local pid = tonumber(read_all("/var/run/dnsmasq/dnsmasq.pid"))
if pid then
nixio.kill(pid, 1)
end
end
end