summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-system/luasrc/controller
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2019-03-08 13:26:19 +0100
committerFlorian Eckert <fe@dev.tdt.de>2019-03-11 16:09:13 +0100
commita37296dda8b90739b73b0a0fdc3b271405dd2ec1 (patch)
tree6da73fd47e9cd245ce8e7d3c60c6081cabb25ec7 /modules/luci-mod-system/luasrc/controller
parentdb98461321806d718be8627d75ffa75641f6c0a4 (diff)
luci-mod-system: add button to sync with ntp server
Especially for systems without RTC this change has two advantages * manual time sync with time server during configuration * test possibility of the time sync over the configured servers Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'modules/luci-mod-system/luasrc/controller')
-rw-r--r--modules/luci-mod-system/luasrc/controller/admin/system.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/luci-mod-system/luasrc/controller/admin/system.lua b/modules/luci-mod-system/luasrc/controller/admin/system.lua
index 3e58896d63..49d4476c4e 100644
--- a/modules/luci-mod-system/luasrc/controller/admin/system.lua
+++ b/modules/luci-mod-system/luasrc/controller/admin/system.lua
@@ -9,6 +9,7 @@ function index()
entry({"admin", "system", "system"}, cbi("admin_system/system"), _("System"), 1)
entry({"admin", "system", "clock_status"}, post_on({ set = true }, "action_clock_status"))
+ entry({"admin", "system", "ntp_restart"}, call("action_ntp_restart"), nil).leaf = true
entry({"admin", "system", "admin"}, firstchild(), _("Administration"), 2)
entry({"admin", "system", "admin", "password"}, template("admin_system/password"), _("Router Password"), 1)
@@ -64,6 +65,14 @@ function action_clock_status()
luci.http.write_json({ timestring = os.date("%c") })
end
+function action_ntp_restart()
+ if nixio.fs.access("/etc/init.d/sysntpd") then
+ os.execute("/etc/init.d/sysntpd restart")
+ end
+ luci.http.prepare_content("text/plain")
+ luci.http.write("0")
+end
+
local function image_supported(image)
return (os.execute("sysupgrade -T %q >/dev/null" % image) == 0)
end