Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cronjob issue

Status
Not open for further replies.

cpu533

IS-IT--Management
Nov 6, 2003
68
CA
Hi gurus,
I have very strange issue here.
I schedule the job to run at 10:01 AM, however it starts to run at 9:01AM. It sounds like caused by daylight saving.

1 10 * * 0,2-6 ksh -c "/sitemgr/backup/bkupproc/appbkup.ksh rmt1"

But the "date" command shows correct time.
Thu Mar 11 09:13:54 EST 2010

The AIX version is 5300-08

Please help.

Thanks,
Denny
 
What does echo $TZ show?

The internet - allowing those who don't know what they're talking about to have their say.
 
echo $TZ

EST5EDT,M3.2.0,M11.1.0
 
What is the TZ in the file /etc/environment?
Was this file changed after the system was booted?

Your cron process is probably running in a different timezone. I'd reboot the server at your next maintenance slot.

To find the TZ setting for your corn process, you can do the following:

Code:
ps -ef|grep cron
#use the PID in next command pipeline
ps eww PPPPPPP | tr ' ' '\n' | egrep '^TZ=' | cut -d= -f2-

HTH,

p5wizard
 

EST5EDT,M3.2.0,M11.1.0

same as the setting in environment file.

thanks,
Denny
 
What about a test script like this (perhaps you did that already?


[tt]
cat /tmp/datetest.sh
[red]#!/bin/ksh
echo $TZ
date[/red]

chmod 755 /tmp/datetest.sh

# now run this script from cron

echo /tmp/datetest.sh | at now + 1 min
[/tt]

Wait a minute and then check your unix mail for the output.


HTH,

p5wizard
 
here is output, i only copy the interesting portion.

Message 1:
From daemon Thu Mar 11 11:33:36 2010
Date: Thu, 11 Mar 2010 11:33:36 -0500
From: daemon

Your "at" job executed on newip on Thu Mar 11 12:33:36 EDT 2010

This really confused me.

Thanks,
 
Well, you DIDN'T copy the interesting (for me) portion...

Where's the output of

[tt][red]echo $TZ
date[/red][/tt]

please?

HTH,

p5wizard
 
sorry, here is the output you are looking for.

Your "at" job executed on newip on Thu Mar 11 14:14:20 EDT 2010
/temp/datetest.ksh

produced the following output:

EST5EDT,M3.2.0,M11.1.0
Thu Mar 11 13:14:20 EST 2010


Thanks,
Denny
 
How did you put this line in crontab ?

1 10 * * 0,2-6 ksh -c "/sitemgr/backup/bkupproc/appbkup.ksh rmt1"

By using crontab -e ( which edit and restart cron daemon )
or by editing the underlied file using your favorite editor in which case, you are still using old crontab.
 
i am using "crontab -e" to schedule the job.
But does it really matter?

Thanks,
 
It can be matter if the old crontab contains the same action scheduled at 9:01 and was edited using say vi to change the time at 10:01.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top