NTP cron job runs every 5 min instead of hour
I can't figure this out. I have the following crontab entry
Code:
0 * * * * ntpdate us.pool.ntp.org Code:
19:11:33.389970 IP 192.168.1.107.123 > 63.240.161.99.123: NTPv4, Client, length 48 Update: I just deleted the cronjob with crontab -r and it is still syncing every 5 minutes, and I still can't figure it out... |
See if there's a daemonised process or similar running (are you running ntpd?)
ps aux | grep ntp |
Yeah only ntpd is running. Is that what's causing this?
|
Quote:
|
Well I tried disabling NTPD and only using a cron ntpdate job, but no NTP traffic was sent. Which is odd since I can use ntpdate manually and NTP traffic is sent so I don't know why cron isn't working.
|
Try adding a "user" to cron job entry. Example:
0 * * * * root ntpdate us.pool.ntp.org |
ntpd does more than you think, it keeps correct time even between syncing using drift file. I do not understand why someone would want to disable it.
|
Quote:
2 * * * * * root ntpdate us.pool.ntp.org 1 * * * * * root echo Testing I checked and the crond is running as well. This is all on a Red Hat 9 box if it matters... |
Quote:
|
Use the full path to ntpdate command and the "-s" option:
Code:
0 * * * * /usr/sbin/ntpdate -s us.pool.ntp.org |
Man with your suggestion and what I just found on a website I thought I had it. The website said use */n * * * * command to run something every n minutes. My current crontab looks like this
Code:
1 * * * * /usr/sbin/ntpdate -s us.pool.ntp.org |
Yes, but if your computer clock is not accurate enough then running ntpdate will cause time jumps. Depending how big those jumps are you may get weird errors.
|
Emerson, then how can I tell ntpd how often I want it to sync to the NTP server? I haven't found anything in the /etc/ntp.conf or google on how to do that.
|
It works! I just checked my mail and cron was complaining that the root command wasn't found so I deleted root and cron finally works now. Thanks for everyones help!
Emerson I'm still interested in using ntpd if it's possible to change how often it syncs with the ntp server. |
Is it new install? Once ntpd gets "familiar" with your computer clock it should increase the sync interval to 1024 s, isn't this interval long enough?
|
Yeah it's a new install. I guess I never did give it a chance to get familiar with my system. I'll give it another try... Thanks for everyones help!
|
If it's new install then there is absolutely NO EXCUSE to run RH-9. Please consider installing a modern Linux distro. Besides security risks you are missing out on tons of new features.
http://www.linuxquestions.org/questi...-linux-524947/ |
you don't tell ntpd how often to sync, it doesn't work like that, and it's kind of the case that you need to appreciate that it has reasons to do what it does.
ntpd will eventually slow down automatically to synchronize once every 1024 seconds, about 17 minutes. but if it is doing it more often than this then it has a good reason to. i found ntpd to be real black magic until i found the ntpq command. run "ntpq -pn" and you can see the current state of the ntp daemon. how often it's query the remote servers, which one's it's using etc... it's really an eye opener once you look at that. that said i've had awful trouble getting a reliable time source under vmware and did have to use a cold hard ntpdate command to reign it in, but that's a very different story. oh hey, there was a 2nd page! |
All times are GMT -5. The time now is 09:22 PM. |