Keep time up to date with ntpdate

Often the clock times, which are transmitted by the mainboard to the server operating system, are not optimal. For this reason, a small tutorial on how to keep the time of your dedicated or vServer always up to date.

The software ntpdate is used, which can be installed on Ubuntu/Debian with the following command:
apt-get install ntpdate

 

Once ntpdate has been successfully installed, you can use an Internet time server to update the server's time. The command for this would be:
ntpdate ptbtime1.ptb.de

 

After executing this command the software ntpdate gets the time from the time server and compares it with the system time. Since the system time can change e.g. at time changes, it is recommended to set up a regular update via cronjob:
echo "0 0 * * * /usr/sbin/ntpdate ptbtime1.ptb.de ptbtime2.ptb.de >/dev/null 2>&1" >> /etc/crontab

 

After entering the command, the time updates every 24 hours at 0 o'clock.
Tags