[lug] crontab range

Davide Del Vento davide.del.vento at gmail.com
Tue Apr 7 16:06:15 MDT 2015


Is there a shortcut that allows my crontab to run every x minutes (say,
x=5) from 21:45 to 1:55 in a oneliner, without going to the verbose:

# minute (0-59)
# |      hour (0-23)
# |      |      day of the month (1-31)
# |      |      |    month of the year (jan-dec)
# |      |      |    |     day of the week (sun-mon, with 0=sun)
# |      |      |    |     |        command
# |      |      |    |     |        |
#
45-59/5 21      *    *     *        my-command
0-59/5  22-23   *    *     *        my-command
0-59/5  0       *    *     *        my-command
0-55/5  1       *    *     *        my-command

Or at least save some lines so I can be DRY in my-command? The following:

0-59/5  22-0   *    *     *        my-command

is declared:

"/tmp/crontab.6hXZFX":12: bad hour
errors in crontab file, can't install.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20150407/78d17279/attachment.html>


More information about the LUG mailing list