How would I go about creating a cronjob that runs at the following times every day:

  • 3:00am
  • 3:50am
  • 9:00am
  • 9:50am

I tried this but it doesn't seem to be working:

00,50    3,9    *    *    *    /usr/bin/something.sh


The Solution

After much poking around in the logs, it turns out the issue was another script higher up in the crontab was segfaulting so my crontab entry never ran at all.

I disabled those scripts and my entry ran just fine. Also, it turns out that the syntax above is perfectly valid.

link|improve this question

feedback

3 Answers

up vote 4 down vote accepted

Is /usr/bin/something.sh executable ?

Check

/var/log/cron or /var/log/messages

depending on your distribution.

link|improve this answer
For what it's worth, the script runs properly if I tweak the times in the crontab. It seems to be an issue with how I was trying to do multiple minutes. – Mark Biek Jun 12 '09 at 13:52
1  
So, in the end, not a crontab syntax issue at all. Thanks for pointing me in the right direction. – Mark Biek Jun 12 '09 at 14:18
feedback

Both of the above are good answers/questions. I ran across this yesterday and it might give you some ideas:

Practical Crontab Examples

link|improve this answer
feedback
0 3,9 * * * /usr/bin/something.sh
50 3,9 * * * /usr/bin/something.sh
link|improve this answer
Duh. That seems so obvious now. – Mark Biek Jun 12 '09 at 13:51
The two should be example, most crons accept ranges in any of the 5 fields. Which OS ? – Dave Cheney Jun 12 '09 at 13:57
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.