Update server time

Keeping your server(even local computer) clock accurate is very important for the services it offers. Otherwise there will be huge discrepancies and faulty services. For example, if a forum is hosted on the server posts will have incorrect time and this will highly irritate members.

In order to have your time always accurate two things should be done:

1. Make sure that your timezone is correct. This can be verified by opening the file /etc/timezone. For example, if you are in Europe, Sofia it should say:


Note: Sometimes on a server might be hosted clients with different tiimezones. Then you will have to try adjust the timezone per service / client. For example, PHP has a setting date.timezone which can be used to set specific timezone for a customer script.

2. Next step is to ensure that your server clock is regularly synchronized with NTP servers. This can be done with Linux command ntpdate. For example:

# /usr/sbin/ntpdate -u -s at.pool.ntp.org &

This will ensure your clock is updated silently and in the background from an Austrian ntp server. This can be added as a cron job and executed every day.

To check all the available ntp servers please check the official public ntp servers pool. Make sure to pick a local server so that accuracy is high.

blog comments powered by Disqus