2

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.

0

5 Answers 5

5

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

1
  • Yah, after a bit more research, the problem is quite likely hidden somewhere else. Thanks for the answer.
    – Ryan Liang
    May 8, 2009 at 14:36
4

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 [email protected]" inside the run_program_A to verify that it's running
2

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?

1
  • 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, 2009 at 14:35
1

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

1

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

Not the answer you're looking for? Browse other questions tagged .