Linux - Sync time using google web server

Reference : http://superuser.com/questions/307158/how-to-use-ntpdate-behind-a-proxy

I got problem to sync time on my Linux controllers using ntpdate because they are under proxies & firewall. I found a simple solution and it's using google web server time.
Execute this
sudo date -s "$(wget -S "http://www.google.com/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
if the timezone is not configured yet, simply run this command
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime 
or using wizard
dpkg-reconfigure tzdata

0 comments:

 
Copyright © peyotest