Operating System - HP-UX
1847092 Members
5933 Online
110262 Solutions
New Discussion

Re: Incorrect crontab time

 
Tracey
Trusted Contributor

Incorrect crontab time

I have several K460's running 10.20, one of them is an hour off when the crontab starts; i.e. I have it set for 21 hundred hours, and it starts at 22 hundred hours. I've checked and compared the timezone parameters between machines, they are all identical. Here is what I checked:

/etc/TIMEZONE >>Set to EST5EDT
/etc/profile >>Set to EST5EDT
/etc/cron.profile >>Set to EST5EDT
{{This is my self-made cron profile}}

Kernal Parameters:
timezone=300 (minutes East of Greenwich)
dst=1 (daylight savings time)

What else could be incorrect?
15 REPLIES 15
John Palmer
Honored Contributor

Re: Incorrect crontab time

What is the dodgy server time set to? Do 'date -u' to get UCT.
Is it the same as the servers that work ok?
It sounds like a Daylight Savings time issue to me.
Rick Garland
Honored Contributor

Re: Incorrect crontab time

Is the time correct on the K460?

Has the crontab file for the user been re-read? Are you using crontab -e or modifing the crontab file directly? If modifing the crtontab file directly, will need to stop/start the crom process so the file is re-read. This will pick up any cjanges that have been made to the crontab file(s).
John Palmer
Honored Contributor

Re: Incorrect crontab time

One other possibility...

Have you changed the time on this server with the 'date' command? If so, you ought to stop and restart the cron daemon:-

/sbin/init.d/cron stop
/sbin/init.d/cron start
Tracey
Trusted Contributor

Re: Incorrect crontab time

date -u returns the current time + 4 hours.

Crontab are edited in a text file and then replaced with "crontab
date hasn't been set since long before the last machine boot.

Oh yeah, I do have the lastest cron patch PHCO_19985
Rick Garland
Honored Contributor

Re: Incorrect crontab time

stop/start the cron process.
CHRIS_ANORUO
Honored Contributor

Re: Incorrect crontab time

Hi Tracey,

In your Kernel Parameters:
set timezone=240

That is where the problem is coming from. This will reboot your server.

When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Tracey
Trusted Contributor

Re: Incorrect crontab time

Chris,

My Timezone is EST5EDT, which indicates that we are 5 hours west of greenwich 5*60 minutes=300 not 240. Why do you suggest 240? All of my machines are set to 300 and they all work fine - even with MS Exchange email date. Just this one is a problem child.
P V Patel
Advisor

Re: Incorrect crontab time

Hi,
First stop and start cron with following comands.
/sbin/init.d/cron stop
/sbin/init.d/cron start
Then run crontab -e command and save cron file.
P V Patel

Punjabhai
John Palmer
Honored Contributor

Re: Incorrect crontab time

Tracey,

You system date (GMT + 4 hours) is correct for EDT. We in the UK are currently on BST (GMT-1) and are 5 hours ahead of EDT.

I don't believe that the kernel parameter is significant.

Is there any difference between the file '/usr/lib/tztab' which defines the time zones on your problem server and one that is OK.?

If you examine that file you should see a section defining EST5EDT and when daylight savings time is in operation.

I also presume that 'date' returns the correct time EDT?

Regards,
John
Tracey
Trusted Contributor

Re: Incorrect crontab time

John,

The file /usr/lib/tztab are identical between the good/bad machines.

Yes "date" comes up with the correct info! :)
Rick Garland
Honored Contributor

Re: Incorrect crontab time

Have you tried stoping/restarting the cron process?

It appears that your setup is correct but it is unknown if you have re-read the crontab file by bouncing the cron process.
John Palmer
Honored Contributor

Re: Incorrect crontab time

Tracey,

I would also create a test cron entry to run a dummy job on the next hour to see whether restarting cron has fixed the problem.

Just get it to 'env'. When you check mail after the job has run you can also check what environment variables are being inherited from cron.

Regards,
John
Rick Garland
Honored Contributor

Re: Incorrect crontab time

In reading the previous posts, you are correct. East Coast time is 5 hours from Greenwich time so that would be 300 minutes. EST5EDT. As you stated previously, you have the kernel param of timezone set to 300.
James R. Ferguson
Acclaimed Contributor

Re: Incorrect crontab time

Tracey:

I agree with John: I don't think the kernel parameter matters here. Document #W3396367 notes that "Most commands, which rely on...library routines, will get the correct behavior as long as the TZ environment variable is properly set for the users' environments, and ignore any values for the kernel parameters such as timezone.". See also document #W3608538. It contains some interesting comments on programattic access to various time functions.

Make sure that /etc/TIMEZONE is executable. It is sourced by /etc/profile in preference to setting a hard-coded TZ value.

For some pecularities of sendmail, see document #KBRC00001686. Sendmail uses a varible called in the
/etc/mail/sendmail.cf file which sets the timezone for mail messages.

...JRF...
Nadeem Siddiqui
New Member

Re: Incorrect crontab time

I think you have a problem with the time syncronization, checking the following link might be helpful. http://devresource.hp.com/STK/man/11.00/dtscp_1m.html
Be all you can be