1834406 Members
1822 Online
110067 Solutions
New Discussion

Re: cron problem

 
Jan Verheijen
Occasional Advisor

cron problem

We have a cron job to start every day except Sunday at 20:00 H.
Last Friday at 11:00 am the cron job started twice!
How is this possible?
Any suggestions?
Live Today
10 REPLIES 10
Rajeev  Shukla
Honored Contributor

Re: cron problem

Its not possible untill some one has changed...
1. The time of the system.
2. Changed the time Zone of the system.
3. Changed the cron entry itself.

Please have a look at all above three only these could be the problem or see the cron log to /var/adm/cron/log file to see the exact time the job started.

rajeev
S.K. Chan
Honored Contributor

Re: cron problem

In addition ..
If for some reason the timezone or time of your system is changed, the cron daemon must be restarted. Otherwise this can potentially cause it to run twice. Another thing that you may want to check is patch. Look for any cron related patch and make sure (if any) your system is uptodate on these patches.
Steven E. Protter
Exalted Contributor

Re: cron problem

Can you upload the cron command line? The whole thing.

It might be what the others suggested. Or....

You are connected to a time server and someone adjusted the time on that server. Is xntpd running?

ps -ef | grep xntpd

Thinking further in my fever impaired mind I know how ntp works and that probably can't happen.

Could perhaps the date command been run on this server. Done at the right time, a small adjustment could trigger flakey behavior.

Are you current on cron patches?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
john korterman
Honored Contributor

Re: cron problem

Hi Jan,
it is difficult to say, as I do not know how you have detected that the job was executed twice. I assume that the job was not simply executed from the command line; but could the job not be executed by two different users simultanously: cron or at job?
Anyway, if you have not already done it, check the general cron log, /var/adm/cron/log, which records which user did it, and when it started/stopped. Check also the content of each user's crontab and at files under /var/spool/cron/crontabs /var/spool/cront/atjobs in order to see any indication of the job in question having been executed by two different users.
If that is the case, but the time does not fit, then check whether the users in question have an individual setting of the TZ variable that differs from the general system setup.

regards,
John K.
it would be nice if you always got a second chance
Bruce Laughlin
Frequent Advisor

Re: cron problem

Hi Jan,

It would be helpful if you would post the applicable cron job entry from the output of crontab -l for the user.

Thanks,
Bruce Laughlin
HPUX GSE
Fred Martin_1
Valued Contributor

Re: cron problem

We had a similar thing happen and discovered that there were two timezone files on the system. On an HP-UX system I think it's at /etc/TIMEZONE.

Anyway on this Linux system there was one in the correct location, and a modified copy someplace else.

Someone changed a PATH setting, and suddenly the clocks where off, only discovered because a cron job misfired.

Turned out that the wrong timezone file was being accessed.

Anyway this is pretty remote and may not apply but it demonstrates how odd some this stuff can get.
fmartin@applicatorssales.com
Jan Verheijen
Occasional Advisor

Re: cron problem

The cron job is :
# Kopieren ME10-macros
00 20 * * 1-6 /usr/local/bin/save_me10_macro

The date is now:
Fri Feb 21 13:00:32 MET 2003

xntpd is not running!

The job was runned twice by cron.
Live Today
Pete Randall
Outstanding Contributor

Re: cron problem

Does /usr/local/bin/save_me10_macro, by any chance, resubmit itself via at?

I know - this is a shot in the dark but the logical explanations seem to have been exhausted a long time ago.

Pete

Pete
Robert-Jan Goossens
Honored Contributor

Re: cron problem

Hallo,

Could you check the date on process cron and compare it to the date of /var/spool/cron/crontabs/"user", maybe someone changed the cron with vi instead of crontab -e.

Hope it helps,

Robert-Jan.
Bruce Laughlin
Frequent Advisor

Re: cron problem

Hi,

I'd take a look at the cron log file /var/adm/cron/log and see if there is anything interesting there.

Best regards,
Bruce Laughlin