Cron

Parses /etc/cron.d/*, /etc/crontab

Author: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com

Summary
CronParses /etc/cron.d/*, /etc/crontab
ReferenceThis lens tries to keep as close as possible to `man 5 crontab` where possible.
LicenseThis file is licensed under the GPL.
Lens UsageSample usage of this lens in augtool
Configuration filesThis lens applies to /etc/cron.d/* and /etc/crontab.
USEFUL PRIMITIVES
Generic primitives
eol
indent
comment
empty
num
alpha
alphanum
Separators
sep_spc
sep_eq
ENTRIES
shellvarA shell variable in crontab
minute
hour
dayofmonth
month
dayofweek
user
timeTime in the format “minute hour dayofmonth month dayofweek”
the valid values for schedules
scheduleTime in the format “@keyword”
entryA crontab entry
lnsThe cron lens
filter

Reference

This lens tries to keep as close as possible to `man 5 crontab` where possible.

License

This file is licensed under the GPL.

Lens Usage

Sample usage of this lens in augtool

  • Get the identifier of the devices with a “Clone” option:
match "/files/etc/X11/xorg.conf/Device[Option = 'Clone']/Identifier"

Configuration files

This lens applies to /etc/cron.d/* and /etc/crontab.  See filter.

USEFUL PRIMITIVES

Generic primitives

eol

let eol = Util.eol

indent

let indent = Util.indent

comment

let comment = Util.comment

empty

let empty = Util.empty

num

let num = /[0-9\*][0-9\/,-\*]*/

alpha

let alpha = /[A-Za-z]{3}/

alphanum

let alphanum = num | alpha

Separators

sep_spc

let sep_spc = Util.del_ws_spc

sep_eq

let sep_eq = Util.del_str "="

ENTRIES

shellvar

let shellvar = [ key /[A-Z][A-Za-z0-9]*/ . sep_eq . Shellvars.simple_value . eol ]

A shell variable in crontab

minute

let minute = [ label "minute" . store num ]

hour

let hour = [ label "hour" . store num ]

dayofmonth

let dayofmonth = [ label "dayofmonth" . store num ]

month

let month = [ label "month" . store alphanum ]

dayofweek

let dayofweek = [ label "dayofweek" . store alphanum ]

user

let user = [ label "user" . store Rx.word ]

time

let time = [ label "time" . minute . sep_spc . hour . sep_spc . dayofmonth . sep_spc . month . sep_spc . dayofweek ]

Time in the format “minute hour dayofmonth month dayofweek”

the valid values for schedules

schedule

let schedule = [ label "schedule" . Util.del_str "@" . store schedule_re ]

Time in the format “@keyword”

entry

let entry = [ label "entry" . indent . ( time | schedule ) . sep_spc . user . sep_spc . store Rx.space_in . eol ]

A crontab entry

lns

let lns = (empty | comment | shellvar entry)*

The cron lens

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
let sep_spc = Util.del_ws_spc
let sep_eq = Util.del_str "="
let shellvar = [ key /[A-Z][A-Za-z0-9]*/ . sep_eq . Shellvars.simple_value . eol ]
A shell variable in crontab
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 ]
let time = [ label "time" . minute . sep_spc . hour . sep_spc . dayofmonth . sep_spc . month . sep_spc . dayofweek ]
Time in the format “minute hour dayofmonth month dayofweek”
let schedule = [ label "schedule" . Util.del_str "@" . store schedule_re ]
Time in the format “@keyword”
let entry = [ label "entry" . indent . ( time | schedule ) . sep_spc . user . sep_spc . store Rx.space_in . eol ]
A crontab entry
let lns = (empty | comment | shellvar entry)*
The cron lens
Close