applications/luci-upnp: also stop miniupnpd if it is about to be disabled
[project/luci.git] / applications / luci-upnp / luasrc / model / cbi / upnp / upnp.lua
index a485081..97fe88e 100644 (file)
@@ -20,6 +20,9 @@ e.rmempty = false
 
 function e.write(self, section, value)
        local cmd = (value == "1") and "enable" or "disable"
 
 function e.write(self, section, value)
        local cmd = (value == "1") and "enable" or "disable"
+       if value ~= "1" then
+               os.execute("/etc/init.d/miniupnpd stop")
+       end
        os.execute("/etc/init.d/miniupnpd " .. cmd)
 end
 
        os.execute("/etc/init.d/miniupnpd " .. cmd)
 end