diff --git a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua index bd6499d..4a910c9 100644 --- a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua +++ b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua @@ -12,7 +12,6 @@ s.addremove = false o = s:option(Flag, "enable_dial", translate("Enable Dial")..translate("(Global)")) o.rmempty = false - o = s:option(Button, "reload_dial", translate("Restart Dial Service")) o.inputstyle = "apply" o.write = function() @@ -29,6 +28,13 @@ o = s:option(Flag, "enable_dial", translate("Enable Dial")) o.width = "5%" o.rmempty = false +restart_btn = s:option(Button, "_redial", translate("ReDial")) +restart_btn.inputstyle = "remove" +function restart_btn.write(self, section) + sys.call("/etc/init.d/qmodem_network redial "..section.." > /dev/null 2>&1") + luci.http.redirect(d.build_url("admin", "modem", "qmodem", "dial_overview")) +end + o = s:option(DummyValue, "name", translate("Modem Model")) o.cfgvalue = function(t, n) local name = (Value.cfgvalue(t, n) or "") @@ -80,6 +86,8 @@ function remove_btn.write(self, section) end -- 添加模块拨号日志 m:append(Template("qmodem/dial_overview")) - +m.on_after_commit = function(self) + sys.call("/etc/init.d/qmodem_network reload > /dev/null 2>&1") +end return m diff --git a/luci/luci-app-qmodem/po/zh-cn/qmodem.po b/luci/luci-app-qmodem/po/zh-cn/qmodem.po index 2185ca2..be25ea4 100644 --- a/luci/luci-app-qmodem/po/zh-cn/qmodem.po +++ b/luci/luci-app-qmodem/po/zh-cn/qmodem.po @@ -130,6 +130,9 @@ msgstr "模组别名" msgid "Modem Status" msgstr "模组状态" +msgid "ReDial" +msgstr "重拨" + msgid "Remove Modem" msgstr "移除模组" diff --git a/luci/luci-app-qmodem/po/zh_Hans/qmodem.po b/luci/luci-app-qmodem/po/zh_Hans/qmodem.po index 2185ca2..be25ea4 100644 --- a/luci/luci-app-qmodem/po/zh_Hans/qmodem.po +++ b/luci/luci-app-qmodem/po/zh_Hans/qmodem.po @@ -130,6 +130,9 @@ msgstr "模组别名" msgid "Modem Status" msgstr "模组状态" +msgid "ReDial" +msgstr "重拨" + msgid "Remove Modem" msgstr "移除模组" diff --git a/luci/luci-app-qmodem/root/etc/init.d/qmodem_network b/luci/luci-app-qmodem/root/etc/init.d/qmodem_network index 1f95d09..98ec904 100755 --- a/luci/luci-app-qmodem/root/etc/init.d/qmodem_network +++ b/luci/luci-app-qmodem/root/etc/init.d/qmodem_network @@ -37,6 +37,7 @@ reload_service() { force_stop=0 mkdir -p $MODEM_RUNDIR + sleep 1 update_modem } @@ -49,7 +50,7 @@ update_modem(){ dial() { - _dial $1 + rc_procd _dial $1 } hang() @@ -79,9 +80,9 @@ _update_modem() fi data=$(_procd_ubus_call list | jq -r ".$service.instances.modem_$1") [ "$data" == "null" ] && current_status=0 || current_status=1 - logger -t qmodem_network "current:$current_status;target:$target " + logger -t qmodem_network "cfg:$1 current:$current_status;target:$target " if [ "$current_status" != "$target" ];then - [ "$target" -eq 1 ] && _dial $1 || _hang $1 + [ "$target" -eq 1 ] && dial $1 || hang $1 logger -t qmodem_network "update modem cfg: $1 dial:$target" fi } diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh index a11cbb8..1eb1386 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh @@ -683,7 +683,7 @@ qmi_dial() fi cmd_line="$cmd_line -f $log_file" m_debug "dialing $cmd_line" - $cmd_line + exec $cmd_line }