?
Solved

crontab runs its jobs 7 hours too late

Posted on 2005-03-10
6
Medium Priority
?
775 Views
Last Modified: 2013-11-17
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
Comment
Question by:Lieven Embrechts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 11

Expert Comment

by:griessh
ID: 13511763
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
 
LVL 11

Expert Comment

by:griessh
ID: 13511768
second though ... add a "echo $TZ", too
0
 
LVL 62

Expert Comment

by:gheist
ID: 13514076
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:esanchezvela
ID: 13515226

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
 
LVL 62

Accepted Solution

by:
gheist earned 1500 total points
ID: 13519162
AIX is eveil in regard to stopping cron. It always asks for reboot on TZ changes.
0
 
LVL 9

Author Comment

by:Lieven Embrechts
ID: 13724835
rebooting was neccesary to acitivate timezone settings.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question