Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello, friends.
I have a problem with my crontab for root and non-root user.
I created:
0 9 * * * /home/oracle/bin/checktablespace.sh
This script executed in 17:00
I founded:
# more /etc/sysconfig/clock
# The ZONE parameter is only evaluated by system-config-date.
# The timezone of the system is defined by the contents of /etc/localtime.
ZONE="Etc/GMT+4"
UTC=true
ARC=false
# more /etc/issue
Oracle Linux Server release 5.6
Kernel \r on an \m
How can I set my crontab timezone to server timezone?
I wonder if the time/date is set up correctly on your box.
- Is you hardware clock ("BIOS" time) set to UTC or localtime (MSK / GMT+4)?
If it is set to MSK/GMT+4 than your system clock does not use UTC.
From the info you posted it seems like you have a hardware clock that is set to MSK/GMT+4, but you also told the system that the system clock is set to UTC, which is not correct.
If that is true: Re-run the system-config-date command and select the timezone you are in (Etc/GMT+4 or Europe/Moscow) and make sure that the [ ] System clock uses UTC is not selected (no *)
In system-config-date everything is OK.
Command #hwclock --systohc helped me to normalise hwclock time, but crontab works with 8 hours delay.
Problem is something other place.
In system-config-date everything is OK.
Command #hwclock --systohc helped me to normalise hwclock time, but crontab works with 8 hours delay.
Problem is something other place.
Just to make sure: Time and date are shown/used correctly, except when using crontab?
Time and date are shown correctly. I'm not shure abous "used". So crontab time is wrong.
That is strange. The manual page (man anacron) mentions in the NOTES section that the time-zone needs to be set correctly in order for cron to work correctly.
You mention this in your previous reply:
Quote:
Originally Posted by applehalf
In system-config-date everything is OK.
That doesn't tell us if the BIOS clock is set to UTC or your local time (which seems to be MSK).
- What does your BIOS time show: UTC or localtime?
- Which entries are set in the system-config-date tool?
If this machine only runs Linux than the BIOS time should be set to UTC. If this is a dual boot system (Windows/Linux) the BIOS time should be set to localtime. This, the UTC vs localtime setting, should be reflected in the System clock uses UTC entry.
I do believe you need to reboot your machine if you change the time-zone settings, logging out and in again won't reflect the changes made.
One other thing that comes to mind and which might influence time and date: Is the TZ variable set (echo $TZ)
If the cron job actually ran at 1700 vs 0900 then the difference is +6 hours which does not match with a UTC vs local time problem. Was this a typo? In your first post the hardware clock vs system clock were +4 difference which matches your configuration and the hardware (BIOS clock) is set to UTC. However in your last post the hardware clock and date command match.
Does /etc/localtime file exist?
Does the output of the command
zdump -v /etc/localtime | grep 2014
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.