LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   synchronize time and date (https://www.linuxquestions.org/questions/ubuntu-63/synchronize-time-and-date-4175590650/)

Tom27262312 10-03-2016 07:00 AM

synchronize time and date
 
good day!

Please help!
I would like to synchronize the time of server to its client PC
through ssh and I created a script but it didn't work for me. It looks like this.

current_date=`date "=%Y-%m-%d %H:%M:%S"`
ssh user@IP; `date --set=$current_date`;

exit 0

thanks

pan64 10-03-2016 07:10 AM

http://www.cyberciti.biz/faq/howto-s...ommand-prompt/
normal user is not allowed to set date/time
why don't you try ntp?

Turbocapitalist 10-03-2016 08:52 AM

Yes. If your machines have network connections then the package ntp will keep the date and time synchronized for you. Alternately there is openntp. Either one will run quietly in the background and keep time in order.

Which version of Ubuntu do you have? It should already have ntp already installed and running, as far as I know. What problem are you trying to solve?


All times are GMT -5. The time now is 01:26 AM.