Solved

Red hat Crontab Time problem

Posted on 2007-11-22
9
3,461 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
 
LVL 3

Expert Comment

by:amirs80
ID: 20337510
can u post the crontab entry
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Anti-virus for Linux Server 15 127
Installing VirtualBox in Fedora 25 Linux 2 130
Linux/Apache File Ownership/Permissions 1 53
Adding more CPU cores to a Linux VM 5 66
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…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

862 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

Need Help in Real-Time?

Connect with top rated Experts

29 Experts available now in Live!

Get 1:1 Help Now