Wednesday, April 7, 2010

Synchronise time in ubuntu...

Command Line ntpdate


Ubuntu comes with ntpdate as standard, and will run it once at boot time to set up your time according to Ubuntu's NTP server. However, a system's clock is likely to drift considerably between reboots if the time between reboots is long. In that case it makes sense to correct the time occasionally. The easiest way to do this is to get cron to run it every day. With your favorite editor, create a file /etc/cron.daily/ntpdate containing:
 sudo ntpdate ntp.ubuntu.com 

Make sure that you make this new file executable:
 sudo chmod 755 /etc/cron.daily/ntpdate  
 
 
You can stop ntpd by executing:
sudo /etc/init.d/ntp stop
Then set the system clock:
sudo ntpdate ntp.ubuntu.com
And then start ntpd up again:
sudo /etc/init.d/ntp start

Change the time location

dpkg-reconfigure tzdata