How to up date the time of my dedicated server?
Sources of the problem
The problem is usually due to the fact that your server is not on the kernel optimized for its hardware configuration. Therefore, the time of the P4 servers equipped in Hyper Threading is incorrect. In general, you may sort the problem out by booting the server on the correct kernel, the one with the 'optimized for Hyperthreading' mention.
If your server is not in Hyper Threading and you encounter this problem, you just need to follow this manual.
Our manual to up date your kernel via the Netboot is: KernelNetboot
Manage the time in SSH
Our manual for SSH use: SshOnDedicated
Log in root on your server via SSH.
To know the time, you just need to type:
[root@delirium angie]# date
To update the date and/or the time, you may use the command:
Fri Jan 7 15:20:25 CET 2005
[root@delirium angie]# date -s
For example, to up date the date of 19/01/2005:
[root@delirium angie]# date -s 01/19/2005
For example to up date the time at 18:08 and 30 seconds:
[root@delirium angie]# date -s 18:08:30
When the time is not up to date, you may automatically synchronise an atomic clock. To do so, we will use ntpdate
[root@delirium angie]# whereis ntpdate
Synchronise with ntpdate:
ntpdate is then installed and is located in /usr/sbin path
[root@delirium angie]# /usr/sbin/ntpdate cdns.ovh.net
ntpdate has updated the time
19 Jan 20:27:37 ntpdate: adjust time server 188.8.131.52 offset 0.152248 sec
The synchronisation via ntp may be impossible if the difference is too important. In that case, you may force the up date of the date and/or the time (approximatively) before setting the time via NTP in a more precise way. For the commands, see below.
Automate the update
A list of ntp servers is available here
You may, thanks to a cron task, automate the time update.
Insert the cron task by ssh:
[root@delirium angie]# pico /etc/crontab
Your file will then appear ready for the edition. Add the following information:
#synchronisation ntpdate daily at 3am
Quit with Ctrl+X and validate with "Y" or "O" then press enter.
You must restart with crond again:
0 3 * * * root /usr/sbin/ntpdate cdns.ovh.net >/dev/null
[root@delirium angie]"#" /etc/init.d/crond restart
Stop crond : [OK ]
Crond start: [ OK ]
Your server will be up dated every day or according to your need.
Find out more about cron tasks here