Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3625
  • Last Modified:

Red hat Crontab Time problem

I have a Red Hat Server , the problem is that crontab works in a different time that the time of the server.

For exampe date command gives me this :

17:41:02 EET 2007

so I setup a cron to run in 17:42

the cron never runs (I do check the /varlog/cron file).
but If I set the time of the cron with 8 hours difference ( 9:41 ) the cron will acctualy will acctually run at server's time 17:41 ...
The server's time is GMT+2 :


root /usr/share/zoneinfo# ll /etc/localtime
lrwxrwxrwx  1 root root 33 Nov 22 17:23 /etc/localtime -> /usr/share/zoneinfo/Europe/Athens

0
MaRiOsGR
Asked:
MaRiOsGR
1 Solution
 
terrydavisCommented:
Do you have all the latest patches?  There have been significant changes to how DST and timezones work.
up2date -l
OR
yum check-update
0
 
mzalfresCommented:
There is some misconfiguration. You have probably set different system timezone (Europe/Athens) and your login timezone (EET = whatever it is :)).

Run
   date
and note it.
Run
   echo $TZ
If there any output, run:
   unset TZ
Then call 'date' command again. Notice difference. If the difference is 8 hours - you are done.

Next will be to find where the TZ variable is set and unset it permanently - probably somewhere in profile files.

0
 
MaRiOsGRAuthor Commented:
hello mzalfres

take a look at the commands:

root /# date
Thu Nov 22 21:39:02 EET 2007

root /# echo $TZ


echo $TZ gives me a blank line..no output, what should I do ?
0
Independent Software Vendors: 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!

 
amirs80Commented:
can u post the crontab entry
0
 
MaRiOsGRAuthor Commented:
ofcourse , but I dont think that whis would help in any way:

21      9      *       *       *       /scripts/marios.sh

this scedule will acctually run at 17:21pm.
0
 
WizRd-LinuxCommented:
I would say the variable $TZ is manually set for root.

At the beginning of your crontab file add the following:

TZ=EET

This should force the crontab to run in the correct timezone.
0
 
MaRiOsGRAuthor Commented:
I did as you said:

root /# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
TZ=EET


the problem still remains the same.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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