Topic: System Time Syncronization Through Shell

I didn't find anything about it in the forum.
No packages installation needed!

So, only to print date

rdate -p time-a.timefreq.bldrdoc.gov

to set date

sudo rdate time-a.timefreq.bldrdoc.gov

I've put this alias in my ~/.bashrc because of frequent use.

alias time_adjust='sudo rdate time-a.timefreq.bldrdoc.gov'

List of servers here.

I hope this will helpful. smile

Last edited by realgpp (2010-05-18 22:57:51)

Re: System Time Syncronization Through Shell

Nice tip, thank you for sharing. smile

There is also the Network Time Protocol daemon and utility programs, which can be installed to perform similar. From memory, I think the following should get you up and running:

sudo apt-get install ntp

Re: System Time Syncronization Through Shell

very nice...I was searching for something like that for a while...

is there a way to be executed on startup but without the need of sudo (in autostart.sh)???

I know this can be done with ntp but I prefer just a command over a daemon...

Re: System Time Syncronization Through Shell

You can add an exception to you sudoers file

sudo gedit /etc/sudoers

at the end add:
<username> ALL= NOPASSWD: <path-to-rdate>/rdate

I've been told to be carefull with the sudoers file, but this seems to work quit well.

best,
tuna

Re: System Time Syncronization Through Shell

Another great new thing!!! thanks Tunafish...

Re: System Time Syncronization Through Shell

You're welcome!

Re: System Time Syncronization Through Shell

slapfish wrote:

is there a way to be executed on startup but without the need of sudo (in autostart.sh)???

about autostart.sh... i've seen right now that there is this code in the file

rdate -s ntp2.inrim.it 

-s set the date without printing it.
I tried this from the shell and it works fine, so I'm wondering why sometimes the time goes 1/2 hours in the future?

Re: System Time Syncronization Through Shell

@realgpp: Thanks for sharing

Another list of nist servers (also europe)
http://www.dataman.ro/sntp/time-servers/


btw... ntp (as mentioned by corenominal) works fine as well...

Re: System Time Syncronization Through Shell

@tunafish thanks for european nist servers!