LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 10-03-2016, 07:00 AM   #1
Tom27262312
LQ Newbie
 
Registered: Sep 2016
Location: Mandaluyong City, Philippines
Posts: 3

Rep: Reputation: Disabled
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
 
Old 10-03-2016, 07:10 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320Reputation: 7320
http://www.cyberciti.biz/faq/howto-s...ommand-prompt/
normal user is not allowed to set date/time
why don't you try ntp?
 
Old 10-03-2016, 08:52 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
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?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change MariaDb time, synchronize it with the server time (CentOS7)? AdultFoundry Linux - Newbie 1 01-09-2016 03:44 PM
Synchronize all my server using same date and time packets Linux - Hardware 2 09-26-2008 02:05 AM
how to convert windows date and time to unix date and time jitupatil_2007 General 8 03-31-2008 05:58 AM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 03:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration