2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
16 local fs = require "nixio.fs"
17 local cronfile = "/etc/crontabs/root"
19 f = SimpleForm("crontab", translate("Scheduled Tasks"), translate("This is the system crontab in which scheduled tasks can be defined."))
21 t = f:field(TextValue, "crons")
25 return fs.readfile(cronfile) or ""
28 function f.handle(self, state, data)
29 if state == FORM_VALID then
31 fs.writefile(cronfile, data.crons:gsub("\r\n", "\n"))