http://www.perlmonks.org?node_id=1109536

chinmaykmawar has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have a script that has to run at 3:00AM and 6:30AM

Currently i have two different cron entries for each of these. I know how one one entry would be required if it was 3:30 and 6:30.

But is it possible to have one cron entry to run at 3:00 and 6:30?

  • Comment on Different minutes of hour in one crontab entry

Replies are listed 'Best First'.
Re: Different minutes of hour in one crontab entry
by blindluke (Hermit) on Dec 08, 2014 at 09:59 UTC

    Is the script written in Perl? Is the question related to Perl in any way?

    Update: To the point of your question though, even if there was some elaborate syntax (I don't think there is) that would allow you to define such an entry, why would you want to have one very complicated line in your crontab instead of two lines that are perfectly readable? Crontab readability is a much better target than its size.

    - Luke

Re: Different minutes of hour in one crontab entry
by jonadab (Parson) on Dec 08, 2014 at 11:44 UTC

    I don't think this is possible with a traditional Unix cron. It is possible there may be some version of some cron substitute software out there somewhere that has some kind of crontab-format extension to support this, but if so I am not aware of it.

    My advice would be to just put the two lines right next to each other in the crontab file, with a single comment above them for both. Your crontab should be structured this way -- groups of related lines separated by whitespace -- in any case, for readability.

Re: Different minutes of hour in one crontab entry
by marto (Cardinal) on Dec 08, 2014 at 09:56 UTC

    How does this relate to Perl specifically?