Solved

Red hat Crontab Time problem

Posted on 2007-11-22
9
3,440 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
can u post the crontab entry
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 2

Author Comment

by:MaRiOsGR
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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.

772 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

10 Experts available now in Live!

Get 1:1 Help Now