Demystify the meaning of a valid cron string by converting it to an equivalent sentence in English. Can take the output from r2cron for example. (Under development.)

cron2eng(cron = "* * * * *")

Arguments

cron

Character. A valid cron expression, i.e. a string with five time period 'slots' (minutes, hours, days of the month, months, days of the week), separated by spaces. See details for more information.

Value

Result printed to console. An English sentence interpretation of the cron string that was the input.

Details

The cron string slots and their valid ranges are:

  • Slot 1: minutes past the hour, integers 0 to 59 inclusive.

  • Slot 2: hours on a 24-hour clock, integers 0 to 23 inclusive.

  • Slot 3: day number of the month, integers 1 to 31 inclusive.

  • Slot 4: month number, integers 1 to 12 inclusive.

  • Slot 5: day of the week, integers 0 to 6 inclusive (where Sunday is the first day of the week).

In addition, the following input formats are acceptable to all the time slots:

  • a single integer value, like 1

  • consecutive-integer vectors, like 1:3

  • nonconsecutive, irregularly-spaced integer vectors, like c(2, 3, 5)

  • regularly-spaced integer sequences with specified start and end values, like seq(3, 59, 15) (useful for specifying sequences within the full time period,'every 15 minutes of the hour starting from minute 3', like in this example)

Examples

if (FALSE) {
cron2eng("1,2,5 2-3 * 1/3 5")}