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?
|
All times are GMT -5. The time now is 09:50 AM. |