diff options
author | Stan Grishin <stangri@melmac.net> | 2018-01-25 18:30:20 -0800 |
---|---|---|
committer | Stan Grishin <stangri@melmac.net> | 2018-01-25 18:34:09 -0800 |
commit | 1fd24f3fd8836287a418a8f09adc3f0dec04a9d2 (patch) | |
tree | 8ff5f47f95148c99caf306c40181b73665ee5682 /applications/luci-app-vpnbypass/luasrc/model/cbi | |
parent | ee409b66ce8911651a985c6e38690c486fefe1d1 (diff) |
luci-app-vpnbypass: better service start/stop
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-vpnbypass/luasrc/model/cbi')
-rw-r--r-- | applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua index bb27b63818..9d2f5f425c 100644 --- a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua +++ b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua @@ -4,19 +4,11 @@ m = Map("vpnbypass", translate("VPN Bypass Settings")) s = m:section(NamedSection, "config", "vpnbypass") -- General options -e = s:option(Flag, "enabled", translate("Enable/start service")) +e = s:option(Flag, "enabled", translate("Start VPNBypass service")) e.rmempty = false - -function e.cfgvalue(self, section) - return self.map:get(section, "enabled") == "1" and luci.sys.init.enabled("vpnbypass") and self.enabled or self.disabled -end - function e.write(self, section, value) - if value == "1" then - luci.sys.call("/etc/init.d/vpnbypass enable >/dev/null") - luci.sys.call("/etc/init.d/vpnbypass start >/dev/null") - else - luci.sys.call("/etc/init.d/vpnbypass stop >/dev/null") + if value ~= "1" then + luci.sys.init.stop("vpnbypass") end return Flag.write(self, section, value) end |