Operating System - HP-UX
1833832 Members
1935 Online
110063 Solutions
New Discussion

cron job runs, but not when scheduled

 
Kevin Erickson_1
New Member

cron job runs, but not when scheduled

I have a cron job that is scheduled to run at 11:45 each night, but job does not get started for 45-60 minutes after it is scheduled. The cron entry is:
45 23 * * * /home/kae/Load.sh
The first two lines of the script are:
#!/bin/ksh
echo "Load Stamp 1 `date`" > /tmp/kae.$$

When I look at this log file for the last couple of days, the date echoed is:
Load Stamp 1 Tue Nov 26 00:31:26 CST 2002

AND

Load Stamp 1 Wed Nov 27 00:29:49 CST 2002

Anyone have any thoughts?
6 REPLIES 6
Michael Tully
Honored Contributor

Re: cron job runs, but not when scheduled

The first place to look is in the cron log, to make sure that job is starting at the specified time.
/var/adm/cron/log

If the entry is in here at the correct time, it must have something to do with the script your running. Do any other jobs have this problem?
Anyone for a Mutiny ?
Steve Steel
Honored Contributor

Re: cron job runs, but not when scheduled

Hi

You may be hitting maximum cron jobs which will cause a reschedule.

look at the log and

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf6dc0bce6f33d6118fff0090279cd0f9,00.html



Steve steel

Do not meddle in the affairs of Unix, for it is subtle and quick to core dump.
If you want truly to understand something, try to change it. (Kurt Lewin)
john korterman
Honored Contributor

Re: cron job runs, but not when scheduled

Hi,
as already stated, it is probably a matter of reaching the queuedefs max. limit. To find out what causes this, you can examine each users' crontab under /var/spool/cron/crontabsand his/her atjobs under /var/spool/cron/atjobs

regards,
John K.
it would be nice if you always got a second chance
Kevin Erickson_1
New Member

Re: cron job runs, but not when scheduled

Sorry to take so long to get back to this, work had me doing other things. I've looked into cron a bit and see that it is set up to do 100 simultaneous jobs. I have checked the log files and do not see any "full queue" type of messages. The version of cron that we are using on this machine is 82.9.1.29 (dated 02/06/17). I'm finding it very hard to believe that there would be 100 other processes queued up that would prevent this from starting for 30 or more minutes. Does anyone know of a way to check the number of cron jobs that are running on a machine at a given time?
Jeff Schussele
Honored Contributor

Re: cron job runs, but not when scheduled

Hi Kevin,

/var/adm/cron/log should show BOTH the start & end times for all cron jobs - as well as the command run. You can match them up by PID.
What time does the log show for the start of the cron job?
What does it show for the end time? Is that value equal to the perceived time diff?

Another thing to check is
the TZ variable defined for the user running the cron. Does it differ from your TZ?

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Yogeeraj_1
Honored Contributor

Re: cron job runs, but not when scheduled

hi,

try to include also an:
ps -ef >> /tmp/kae.$$

to you script so as to get a list of processes that are executing at that same moment.

you might also check the load on the server at the same time.

Post the results.

Hope this helps!
Best Regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)