Update Time Automatically using NTP

GEEKS!!

I know you all know what is NTP and its purpose. I hope you still remember your RHCE training.

But here I am sharing with you a very small trick that will make sure that your linux server is always updated with the correct time with the NTP server of your choice.

Apart from setting your clock for NTP, one of the best uses of NTP is to synchronize your clock regularly to compensate for the natural drift that occurs with a hardware clock. This drift is caused by various issues such as power fluctuations and hardware problems, but if you synchronize with NTP as often as possible, you can reduce this drift.

Just use the crontab to do the thing for you.

Edit the crontab using crontab -e for something like this

00 03 * * * ntpdate ip-of-ntp-server > /dev/null

So this simple cron will update my #Linux server time with the NTP server of your choice on every day at 0300 hours.

Please feel free to select the frequency of update and ip of ntp server of your choice.

Advertisements