• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 782
  • Last Modified:

crontab runs its jobs 7 hours too late

I have a weird situation with crontab.
it launches all jobs 7 hours later but tells me it runs correctly.

i have a couple of jobs scheduled at 22.30 and 23.45.
first one runs backup, second one runs reports during the night.
both run fine when launched manually,
the backup runs in a couple of minutes, the reports take less than an hour.

when i look at the logs of the procedures the run 7 hours too late.
however when i look in /var/adm/cron/log crontab tells me they run at the correct hour.
however they do not as things are running when i come in at 7.30.
my clock is ok, i think.
Thu Mar 10 22:26:46 NFT 2005


from my crontab entries:
45 23 * * 1-5  /data/erp/batch/nacht.sh     >/data/erp/batch/nacht.log 2>&1
30 20 * * 1-5  /data/erp/bin/backup.sh >/data/erp/bin/backup.log 2>&1

from the cron log:
root      : CMD (  /data/erp/batch/nacht.sh     >/data/erp/batch/nacht.log 2>&1
) : PID ( 11906 ) : Wed Mar  9 23:45:00 2005
root      : CMD (  /data/erp/bin/backup.sh >/data/erp/bin/backup.log 2>&1 ) : PI
D ( 6458 ) : Thu Mar 10 20:30:00 2005

-rwxrwxrwx   1 root     system           74 Mar 10 06:45 nacht.log
-rwxrwxrwx   1 root     system       203057 Mar 10 07:51 nacht.out
-rwxrwxrwx   1 root     system         5487 Mar 09 05:30 backup.log

i rebooted the machine to make sure crontab daemon runs ok.
i have no clue what could be the cause of this...
0
Lieven Embrechts
Asked:
Lieven Embrechts
1 Solution
 
griesshCommented:
Hi Lieven_Embrechts,

That sounds like a timezome issue.
Modify the nacht.sh and backup.sh to print date/time when it starts and finishes. That will give you the final indication when the scripts run and how long.

======
Werner
0
 
griesshCommented:
second though ... add a "echo $TZ", too
0
 
gheistCommented:
what is your timezone as user ( echo $TZ or date ; date -u) ???
does it change when you become root via su -  ???
when you last set your system time ???
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
esanchezvelaCommented:

I agree its a timezone definition problem, probably you dont see it with root or the user defining the cron job because the TZ variable is defined properly in /etc/profile or ~user/.profile

however, the cron daemon and the other system daemons use the definitions stored in /etc/environment

try and use smitty to check the system time and zone ..smitty chtz_date

regards,
esv.
0
 
gheistCommented:
AIX is eveil in regard to stopping cron. It always asks for reboot on TZ changes.
0
 
Lieven EmbrechtsSenior IT ConsultantAuthor Commented:
rebooting was neccesary to acitivate timezone settings.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now