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
Solved

Red hat Crontab Time problem

Posted on 2007-11-22
9
3,492 Views
Last Modified: 2013-12-16
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
Comment
Question by:MaRiOsGR
9 Comments
 
LVL 2

Accepted Solution

by:
terrydavis earned 250 total points
ID: 20335251
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
 
LVL 7

Expert Comment

by:mzalfres
ID: 20335898
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
 
LVL 2

Author Comment

by:MaRiOsGR
ID: 20335920
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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 3

Expert Comment

by:amirs80
ID: 20337510
can u post the crontab entry
0
 
LVL 2

Author Comment

by:MaRiOsGR
ID: 20338222
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
 
LVL 13

Expert Comment

by:WizRd-Linux
ID: 20370309
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
 
LVL 2

Author Comment

by:MaRiOsGR
ID: 20390803
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
 
LVL 1

Expert Comment

by:Computer101
ID: 21197999
Forced accept.

Computer101
EE Admin
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

791 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