Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I have the following two entries in my Crontab job that are set to start at 10:00am.

Job #1

0,20 10 * * 1-5 ./run_program_A

Job #2

0,20 10 * * 1-5 ./run_program_B

At 10:15, I checked my log file and only program B was run. It seemed that program A never got fired off.

If I set the start time for program A to be 10:30, it will be fired off. I am not very familiar with Crontab, so I hope you can shed some light on it. Do I have to ensure all my jobs are not set at the same time?

Thank you in advance.

share|improve this question

marked as duplicate by Iain May 28 '13 at 18:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

5 Answers

cron certainly does not have such constraints. The problem lies somewhere else (for instance, a lock used by both programs).

share|improve this answer
    
Yah, after a bit more research, the problem is quite likely hidden somewhere else. Thanks for the answer. –  Ryan Liang May 8 '09 at 14:36
add comment

A few random things that might help track down the issue:

  • check for a cron log in /var/log
  • make sure you're getting the mail from cron output somewhere (the owner of the cron file, likely), since that might have interesting clues
  • replace "./run_program_A" with 'echo ./run_program_A', just to see if it's getting kicked off at all
  • place "echo 'program A ran' | mailx -s program_A you@yourdomain.com" inside the run_program_A to verify that it's running
share|improve this answer
add comment

No, you shouldn't have to avoid conflicts, cron should cope perfectly well with jobs that start at the same time, or otherwise overlap.

Is there any chance that both scripts are writing to the same log file, such that one script is over-writing the other script's output?

share|improve this answer
    
Thanks for the real quick answer. It shouldn't be the overwrite issue because both programs would create a record in the DB if they are run. The issue could lie in somewhere else. I will dig deeper then. –  Ryan Liang May 8 '09 at 14:35
add comment

Check the /var/log/cron for error messages. There's surely something wrong with how's the "program_B" is called.

share|improve this answer
add comment

20 10 * * 1-5 ./run_program_A > run_program_A.log

check the log file after 10:20 as

ls -ltr run_program_A.log

if the file is generated at 10:20 the issue lies in script run_program_A and not in cron

for cron help

http://scripterworld.blogspot.com/2009/07/unix-crontab-configuration-with.html

share|improve this answer
add comment

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