BRON: The Time Spec format

time spec

The first field in the brontab file is the time spec. Bron uses a time spec similar to cron – similar, but not exactly the same. The brontab file format allows you to specify the following fields:

  • minute
  • hour
  • day
  • month

Note that these are all specified as numbers. Cron patterns like “FRI” or “JAN” or “@monthly” are not currently supported.

NOTE: ‘hour’ must be specified in 24 hour format (0-23), ‘minute’ should be specified without leading zeroes (1-59), ‘day’ should be specified as numbers (1-31), and ‘month’ should be specified as 1-12.

Here’s a simple example of an entry in the brontab:

15 12 * * : check-flash-usage.sh : Check Flash

This exmaple will execute the script called “check-flash-usage.sh” at quarter after 12 PM in your local time zone. This task will be called “Check Flash” in the UI.

Bron doesn’t support as many options as other cron implementations but you can use the following types of patterns:

Type Example Description
single number 1 This is an exact match for the field in which it is found.
an asterix * will match ‘every’ digit for the field in which is is found.
a range 4-8 will match everything within the range, e.g.: 4,5,6,7,8.
a list 1,3,5,7 will match every item in the list, e.g. 1, 3, 5, 7.
an increment 3/20 The first number is the ‘start at’, and the second number is the step. In other words, this example would run every 20 minutes starting at 3 minutes past the hour. The same could be achieved with a list in the minutes field of 3,23,43.
Note that if you use an expression like “*/5”, the * will become 0, so the expression will match every 5 minutes (5, 10, 15, 20…etc).

NOTE:

  • spaces are not alowed within a field (“3/20” is correct, “3 / 20” is WRONG).
  • if you omit a time spec field, the line will be ignored.
  • any line that begins with a # will be ignored as a comment (# marks used elsewhere will be interpreted as part of that field).
  • empty lines are ignored.
  • it is currently undefined what will happen if you use an invalid date (like “60” in the day field. just don’t do it.).

The following is a more complex example of what you can do with bron expressions:

15 */4 * 12 : check-flash-usage.sh : Check Flash

This example would execute the script called ‘check-flash-usage.sh’ every 4 hours at quarter past the hour on every day in December.

Advertisements
%d bloggers like this: