10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1
The idea is to sync time every 10 minutes.
However im waiting now for 15 minutes and
nano /var/log/cron
still returns empty.
Is this cron running?, if yes where can i find prove?
You told it to run every hour at the 10th minute, not every 10 minutes.
Change '10' to '*/10' to get the behavior you are asking for. Or, you could expand it into '0,10,20,30,40,50'
That said, do not do this. Jumping your clock can cause all kinds of nastyness. Set up ntpd properly, which actually alters the lengths of seconds to bring your clock into line without the issues associated with just changing the clock.
What you really want is ntpd
.
ntpdate
gets the (approximate) current time from one one single server and then moves the clock to that time. It's a one-shot update that is primarily useful for getting your server clock "into the right ballpark" at boot time, so that ntpd has less work to do in fine-tuning the clock.
ntpd
on the other hand, repeatedly polls the current time from a list of servers, taking into consideration factors such as network latency and jitter, and then builds a profile over time of each of the upstream servers to determine the correct time generally with a few milliseconds or better. Once it knows the correct time, it then slowly moves the system clock in that direction by adding or removing tiny fractions of a second for each clock tick, and finally stabilizes the local clock so that it won't drift anymore.
However, ntpd
won't move the clock if the time is off by too far of a margin. That's why you may want to run ntpdate
before ntpd
starts up. Note that ntpdate
won't function when ntpd
is running, which may be the problem you're running in to. ntpdate
should only be run at boot time before ntpd is started, and on some systems it's built-in to the ntpd startup script.
This is a broken way to set your time. Do it right and just set up ntpd.
Running ntpdate manually via cron like causes the clock to jump around and this could possibly cause issues for time-sensitive applications. By running ntpd, you avoid this as ntpd gradually slews the system time around to correct it.