diff options
author | Nils Koenig <mail_openwrtdev@newk.it> | 2016-11-12 17:22:18 +0100 |
---|---|---|
committer | Nils Koenig <mail_openwrtdev@newk.it> | 2016-11-25 16:17:55 +0100 |
commit | 222bf48b741680f10b265274c906f684140b42fe (patch) | |
tree | ab78342fd9840f07bec4ea8dd5c103e52b90a2f2 /applications/luci-app-wifischedule/luasrc/controller/wifischedule | |
parent | d7d97723fef1c4e5fe436b15e088d24d558246b3 (diff) |
luci-app-wifischedule: added package
Turns WiFi on and off according to a schedule
Splitted frontend and backend in different packages.
This feature has now a dependency to the package
wifischedule
in openwrt/packages/net which needs to be merged as well.
Signed-off-by: Nils Koenig <openwrt@newk.it>
Diffstat (limited to 'applications/luci-app-wifischedule/luasrc/controller/wifischedule')
-rw-r--r-- | applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua b/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua new file mode 100644 index 0000000000..a33c7aab9a --- /dev/null +++ b/applications/luci-app-wifischedule/luasrc/controller/wifischedule/wifi_schedule.lua @@ -0,0 +1,32 @@ +-- Copyright (c) 2016, prpl Foundation +-- +-- Permission to use, copy, modify, and/or distribute this software for any purpose with or without +-- fee is hereby granted, provided that the above copyright notice and this permission notice appear +-- in all copies. +-- +-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE +-- INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +-- FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +-- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-- +-- Author: Nils Koenig <openwrt@newk.it> + +module("luci.controller.wifischedule.wifi_schedule", package.seeall) + +function index() + entry({"admin", "wifi_schedule"}, firstchild(), "Wifi Schedule", 60).dependent=false + entry({"admin", "wifi_schedule", "tab_from_cbi"}, cbi("wifischedule/wifi_schedule"), "Schedule", 1) + entry({"admin", "wifi_schedule", "wifi_schedule"}, call("wifi_schedule_log"), "View Logfile", 2) + entry({"admin", "wifi_schedule", "cronjob"}, call("view_crontab"), "View Cron Jobs", 3) +end + +function wifi_schedule_log() + local logfile = luci.sys.exec("cat /tmp/log/wifi_schedule.log") + luci.template.render("wifischedule/file_viewer", {title="Wifi Schedule Logfile", content=logfile}) +end + +function view_crontab() + local crontab = luci.sys.exec("cat /etc/crontabs/root") + luci.template.render("wifischedule/file_viewer", {title="Cron Jobs", content=crontab}) +end |