LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-08-2005, 10:50 AM   #1
rubella
Member
 
Registered: Sep 2005
Location: Europe
Distribution: debian sarge
Posts: 65

Rep: Reputation: 15
cronjob ntpdate error


hay folks

i've made a cronjob to sync my date and time with a timeserver using ntpdate...

when i run the script everything works fine, but when i add this one to my cronjob, i get errors...

59 * * * * /bin/timesync.sh

gives me (dmesg): set_rtc_mmss: can't update from 0 to 59

the script is very simple:
ntpdate ntp.blabla.com

there are a lot of topics about this issue, but very technical, and i don't understand the shizzle... it's important for me to correct the systemtime very often because the systems clock is going very wrong..
 
Old 11-08-2005, 02:30 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You're attempting to change it just before the hour changes (59 after the hour) and it appears it is already AT the hour (0) so it is trying to set 59 back to 0 which is quite a leap. You might want to run it in the middle of an hour (30) and see if that helps.

Also you don't need to script it. On my Debian I have:

22 * * * * /usr/sbin/ntpdate ntp.blabla.com >>/var/log/ntpdate.log 2>&1

This tells it to run ntpdate 22 minutes after the hour and is working fine for me.

Also you don't have logging in cron. You should do as I've done above if you want logging OR redirect to /dev/null if you don't want logging. Since cron runs in the background it has nowhere to send its output.

Also if you're time keeps going off it may be your hardware clock is wrong.

Type "hwclock;date". The hwclock will show you what time the hardward clock thinks it is and the date will show you what time the system thinks it is. ntpdate is setting system time only.

Once your system time is correct you can run "hwclock --systohc" which will set your hardware clock to the same time as system. This may keep your system time from going off frequently as you've mentioned it does.
 
Old 11-09-2005, 09:40 AM   #3
rubella
Member
 
Registered: Sep 2005
Location: Europe
Distribution: debian sarge
Posts: 65

Original Poster
Rep: Reputation: 15
jlightner, thx for the response! everything works fine!

what i've done:
change my crontab to:
5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/timesync.sh

so it runs the script every 5 minutes...
in the script i add the full path to ntpdate, otherwise i get an error "command not found"

thx!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NTPDATE will *NOT* work jon_k Linux - Software 8 01-02-2005 05:41 AM
Cronjob Error nigeledge Linux - General 1 07-04-2004 04:45 PM
ntpdate through http proxy thas Linux - Networking 0 05-14-2003 01:50 PM
ntpdate and port adcripps Linux - General 2 09-06-2002 04:38 AM
ntpdate installation. Oberon_sedai Linux - Newbie 1 12-06-2001 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration