Operating System - HP-UX
1825704 Members
3196 Online
109686 Solutions
New Discussion

Re: Cron Job running twice

 
Kathryn Paczowski
Occasional Contributor

Cron Job running twice

Below are two jobs that are currently running twice. When the scripts are executed during the day they only run once.

40 20 * * * /home/dba/pg3/prodsc/dump_nite.bat
40 18 * * * /home/dba/pgd4/diag/nite_diag.bat

Why are they running twice?


6 REPLIES 6
Andrew Maslin
Frequent Advisor

Re: Cron Job running twice

I would check to see what is executing around the same time that might affect it. Also, are you certain that it is actually running twice, or could it be a notification issue where it just looks like it's running twice? What is telling you that it's running twice?

The only other thing I can think of is the standard "make sure you have the latest patch".
Andrew Maslin
Frequent Advisor

Re: Cron Job running twice

I found one other thing. How long has this been occurring? Apparently some problems can occur with the switch to/from daylight savings time. See http://us-support3.external.hp.com/cki/bin/doc.pl/sid=16df271a1df7365b26/screen=ckiDisplayDocument?docId=200000006428146 - basically it says that the problem can occur if the timezone switch happens and the cron is not restarted after the switch.

I'm not sure how this would play into the portion about the scripts running only once when run during the day, however - are they being run in the cron for the same account?
Charles McCary
Valued Contributor

Re: Cron Job running twice

How were the jobs added to cron?

crontab -e ????

The reason I ask is that I've seen similar problems when someone has gone in and edited the /usr/spool/cron/crontabs/[whatever] file with vi, instead of using crontab -e.



A. Clay Stephenson
Acclaimed Contributor

Re: Cron Job running twice

Another thing to check is that there may be the same crontab entries for two different users.
If it ain't broke, I can fix that.
John Waller
Esteemed Contributor

Re: Cron Job running twice

We had a cron problem between 31 March and 2nd April where a job sceduled for Saturday actually ran the Monday. A call to HP gave no explanation. If you are sure that it is not been run by 2 different users try a kill -9 on the /usr/sbin/cron PID and the isuue the /usr/sbin/cron command to restart it. Also their are a couple of patches for cron.
Steven Sim Kok Leong
Honored Contributor

Re: Cron Job running twice

Hi,

Perform the following:

# Check your /var/adm/cron/log

Verify that your scheduled cron jobs are indeed ran twice by cron.

# ps -fae|grep cron

If ps shows two cron processes, then you could have two cron daemons running. One reason why you can have two cron daemons running is because the FIFO file in /var/adm/cron has been accidentally removed. To verify, perform the following:

# ll /var/adm/cron/FIFO

To overcome such a problem, kill off the later cron daemon and then restart your cron daemon:

# /sbin/init.d/cron stop
# /sbin/init.d/cron start

Make sure that the FIFO file is created properly by the cron daemon.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com