Parses /etc/cron.d/*, /etc/crontab
Author: Raphael Pinson rap@gmai l.com hink
Cron | Parses /etc/cron.d/*, /etc/crontab |
Reference | This lens tries to keep as close as possible to `man 5 crontab` where possible. |
License | This file is licensed under the LGPL v2+, like the rest of Augeas. |
Lens Usage | Sample usage of this lens in augtool |
Configuration files | This lens applies to /etc/cron.d/* and /etc/crontab. |
USEFUL PRIMITIVES | |
Generic primitives | |
eol | |
indent | |
comment | |
empty | |
num | |
alpha | |
alphanum | |
entry_prefix | |
Separators | |
sep_spc | |
sep_eq | |
ENTRIES | |
shellvar | A shell variable in crontab |
- prefix of an entry | |
minute | |
hour | |
dayofmonth | |
month | |
dayofweek | |
user | |
time | Time in the format “minute hour dayofmonth month dayofweek” |
the valid values for schedules | |
schedule | Time in the format “@keyword” |
entry | A crontab entry |
lns | The cron lens |
filter |
This lens applies to /etc/cron.d/* and /etc/crontab. See filter.
let eol = Util.eol
let indent = Util.indent
let comment = Util.comment
let empty = Util.empty
let num = /[0-9*][0-9\/,*-]*/
let alpha = /[A-Za-z]{3}/
let alphanum = (num|alpha) . ("-" . (num|alpha))?
let entry_prefix = /-/
let sep_spc = Util.del_ws_spc
let sep_eq = Util.del_str "="
A shell variable in crontab
let shellvar = let key_re = /[A-Za-z-1-9_]+(\[[0-9]+\])?/ - "entry" in let sto_to_eol = store /[^\n]*[^ \t\n]/ in [ key key_re . sep_eq . sto_to_eol . eol ]
let minute = [ label "minute" . store num ]
let hour = [ label "hour" . store num ]
let dayofmonth = [ label "dayofmonth" . store num ]
let month = [ label "month" . store alphanum ]
let dayofweek = [ label "dayofweek" . store alphanum ]
let user = [ label "user" . store Rx.word ]
Time in the format “minute hour dayofmonth month dayofweek”
let time = [ label "time" . minute . sep_spc . hour . sep_spc . dayofmonth . sep_spc . month . sep_spc . dayofweek ]
Time in the format “@keyword”
let schedule = [ label "schedule" . Util.del_str "@" . store schedule_re ]
A crontab entry
let entry = [ label "entry" . indent . prefix? . ( time | schedule ) . sep_spc . user . sep_spc . store Rx.space_in . eol ]
The cron lens
let lns = ( empty | comment | shellvar | entry )*