From 880a4f195ab75203e323bd0736a43fb7a2a93aaa Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Fri, 29 Sep 2023 20:09:53 -0700 Subject: [PATCH] Improve the way we HUP dnsmasq (#953) --- files/usr/local/bin/mgr/namechange.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/usr/local/bin/mgr/namechange.lua b/files/usr/local/bin/mgr/namechange.lua index 7a480d90..48aac33c 100644 --- a/files/usr/local/bin/mgr/namechange.lua +++ b/files/usr/local/bin/mgr/namechange.lua @@ -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