1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2008-2013 Jo-Philipp Wich <jow@openwrt.org>
3 -- Licensed to the public under the Apache License 2.0.
5 local fs = require "nixio.fs"
6 local cronfile = "/etc/crontabs/root"
8 f = SimpleForm("crontab", translate("Scheduled Tasks"), translate("This is the system crontab in which scheduled tasks can be defined."))
10 t = f:field(TextValue, "crons")
14 return fs.readfile(cronfile) or ""
17 function f.handle(self, state, data)
18 if state == FORM_VALID then
20 fs.writefile(cronfile, data.crons:gsub("\r\n", "\n"))
21 luci.sys.call("/usr/bin/crontab %q" % cronfile)