[lug] crontab range

Dan Ferris dan at usrsbin.com
Tue Apr 7 16:23:02 MDT 2015


*/5 22,23,0 * * * ?

On 04/07/2015 04:06 PM, Davide Del Vento wrote:
> 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.
> 
> 
> 
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
> 


More information about the LUG mailing list