Thursday, June 5, 2014

Synchronize date and time on remote board via ssh


If you have a board without a battery then you might want to synchronize a date and time with your computer.


$ DATE=`date` ;  ssh root@192.168.2.2 "TZ=America/Chicago date --set '$DATE' " ; echo "local: ";  date ;  echo "remote: " ;  ssh root@192.168.2.2 " TZ=America/Chicago date  " 
Mon Jun  9 14:04:16 CDT 2014 
local: 
Mon Jun  9 14:04:16 CDT 2014 
remote: 
Mon Jun  9 14:04:16 CDT 2014
Note that output for Mac is CST and for Linux is UTC.