[lug] crontab range

Davide Del Vento davide.del.vento at gmail.com
Tue Apr 7 17:18:29 MDT 2015


'right, I knew that and I forgot, silly me :-)
So I can go down from 4 to 3, possibly two lines, which is good progress.
Any idea to go down to one (without making the command dependent on time,
which is too cumbersome because it's already a wrapper of a wrapper that
gets used for different things at different times, so I can't change it and
I don't want to add another layer of wrapping)?

On Tue, Apr 7, 2015 at 4:23 PM, Dan Ferris <dan at usrsbin.com> wrote:

> */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
> >
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20150407/62ad39e0/attachment.html>


More information about the LUG mailing list