X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_services%2Fcrontab.lua;h=2ae5939c98a65d4a38fdfcdf8f5abe39a17ed681;hp=7a9750f3e4962104204b2ec647e5323e35cda25c;hb=a3850aa3c7ffbee487cfc9a7903b0561e532f335;hpb=3904a012fad31017553063d15dbc399da03dea45 diff --git a/modules/admin-full/luasrc/model/cbi/admin_services/crontab.lua b/modules/admin-full/luasrc/model/cbi/admin_services/crontab.lua index 7a9750f3e..2ae5939c9 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_services/crontab.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_services/crontab.lua @@ -12,24 +12,26 @@ You may obtain a copy of the License at $Id$ ]]-- + +local fs = require "nixio.fs" local cronfile = "/etc/crontabs/root" -f = SimpleForm("crontab", translate("a_s_crontab"), translate("a_s_crontab1")) +f = SimpleForm("crontab", translate("Scheduled Tasks"), translate("This is the system crontab in which scheduled tasks can be defined.")) t = f:field(TextValue, "crons") t.rmempty = true t.rows = 10 function t.cfgvalue() - return luci.fs.readfile(cronfile) or "" + return fs.readfile(cronfile) or "" end function f.handle(self, state, data) if state == FORM_VALID then if data.crons then - luci.fs.writefile(cronfile, data.crons) + fs.writefile(cronfile, data.crons:gsub("\r\n", "\n")) end end return true end -return f \ No newline at end of file +return f