VectorLinux
October 22, 2014, 08:19:12 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Updating system time automatically  (Read 3316 times)
retired1af
Packager
Vectorian
****
Posts: 1264



« on: August 25, 2007, 04:55:00 am »

Is there a way to have VL query a time server periodically to keep the system time updated? I'm loosing time on this machine and it gets rather annoying when I go by the clock on the PC and then discover I'm running late because the #$)(*&#$& clock lost time again.

The strange thing is, the PC stays up and running all the time. Don't understand why I keep loosing time like this.
Logged

ASUS K73 Intel i3 Dual Core 2.3GHz
bigpaws
Vectorian
****
Posts: 1856


« Reply #1 on: August 25, 2007, 06:40:30 am »

ntp is great for this.  Use crontab to schedule time synch.

Bigpaws
Logged
retired1af
Packager
Vectorian
****
Posts: 1264



« Reply #2 on: August 25, 2007, 07:47:48 am »

Heh... Found ntp in the repository and have been playing with it for the past couple of hours. Cotton pickin' thing wouldn't pick up a time server until I remembered my iptables are locked down pretty tight. Had to open up a hole so ntp could query a server. I think it's running OK at this point. Running it as a daemon at startup.
Logged

ASUS K73 Intel i3 Dual Core 2.3GHz
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #3 on: August 25, 2007, 03:07:23 pm »

Just so you know, when I built it, I included a rc startup script.  You can set it up with VASM.  Be patient, it takes many hours to get the time synced with the servers.  It's designed that way.
Logged
jimwill
Member
*
Posts: 43


« Reply #4 on: August 29, 2007, 12:55:46 am »

Just so you know, when I built it, I included a rc startup script.  You can set it up with VASM.  Be patient, it takes many hours to get the time synced with the servers.  It's designed that way.
Ok, I looked at VASM and could not find ntp setup. Where am I missing it?
Logged
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #5 on: August 29, 2007, 03:27:26 am »

Okay
Vasm > Super > Services > Srvset > 4 > ntpd ==> For Graphical Desktop startup
Vasm > Super > Services > Srvset > 2 > ntpd ==> For Textmode Desktop startup

Also consider changing time servers to a one (or three) closer to your geological location. The ones that are listed will get the job done. But closer servers will be much better.
/etc/ntp.conf

I included the link to the time serves in ntp.conf but here it is http://support.ntp.org/bin/view/Servers/NTPPoolServers.

Keep in mind these servers aren't the actual servers you will be connected to.  The servers will redirect you to random servers in the server pool. You can see what servers you are connected with
Quote
ntpq -p
in a console.  The peer you see with a asterisk (*) will be the one your computer will be syncing with.

To check your progress:
Quote
ntpq -c rv | grep stratum
stratum is a level of accuracy.  The lowest number is best.  Stratum 1 servers are usually connected to a GPS device.  You won't be achiving stratum 1. (unless you own a device).  Stratum 3 is considered excellent.  Though it may take hours to get there.  But honestly whats a couple milliseconds for users like us?

In the ntp.conf there are these three lines:
Quote
server   127.127.1.0   # local clock
fudge   127.127.1.0 stratum 10   

If you don't have dialup and or your computer isn't a laptop, you may comment them out.  Your time will be more accurate.  What those line do is set your machine up as a timeserver as well.  So on bootup, if there is no internet connection, the fake server will be choosen rather than no server at all.  If a server isn't chosen, your computer may not continue the boot process.

Sorry for only giving basics.  Ntp IS rocket science.  If you have advanced needs, you should hit the documentation on the ntp website.  Some useful info that is actually human readable can be found here http://gentoo-wiki.com/HOWTO_NTP
« Last Edit: August 30, 2007, 02:52:08 am by exeterdad » Logged
retired1af
Packager
Vectorian
****
Posts: 1264



« Reply #6 on: August 29, 2007, 03:48:58 am »

Hmmmmm. NTP isn't installed by default on SOHO. I don't recall if there's an option to include it during the initial installation. Forgot all about VASM, too. Blood content in my alcohol must be too high.  Cheesy

I ended up doing it the old fashioned way. Installed NTP from the repository, modified the ntp.conf file, and then added the applicable startup commands in rc.local. Worked for me...  Grin
Logged

ASUS K73 Intel i3 Dual Core 2.3GHz
exeterdad
Packager
Vectorian
****
Posts: 2046



« Reply #7 on: August 29, 2007, 06:27:34 am »

Hmmmmm. NTP isn't installed by default on SOHO. I don't recall if there's an option to include it during the initial installation. Forgot all about VASM, too. Blood content in my alcohol must be too high.  Cheesy

I ended up doing it the old fashioned way. Installed NTP from the repository, modified the ntp.conf file, and then added the applicable startup commands in rc.local. Worked for me...  Grin

Stupid blood!   Cheesy
You have to install ntp via slapt-get.  It isn't there by default.
Logged
lagagnon
Global Moderator
Vectorian
*****
Posts: 1922



WWW
« Reply #8 on: August 29, 2007, 07:35:44 am »

I use what I believe to be an easier way than ntp, and does not require the ntp daemon to be running. For a workstation environment it is more than adequate:

- download and install "rdate" from http://www.linuxpackages.net
- in your /etc/cron.weekly directory create an executable script file, say "get_time.sh". It looks like this:

#!/bin/sh
rdate -s time.nrc.ca && hwclock --systohc

- now once a week, if you have crond running (it is by default), your clock will be syncronized to a time server (in this case the main one in Canada, run by the National Research Council, but you should change that time server to one nearer your location. You can find time server addresses via Google).
- if your computer is not running 24/7 you should first install "anacron" so the cron jobs will run at other times.

Logged

"As people become more intelligent they care less for preachers and more for teachers". Robert G. Ingersoll
retired1af
Packager
Vectorian
****
Posts: 1264



« Reply #9 on: August 29, 2007, 08:07:01 pm »

stratum is a level of accuracy.  The lowest number is best.  Stratum 1 servers are usually connected to a GPS device.  You won't be archiving stratum 1. (unless you own a device).  Stratum 3 is considered excellent.  Though it may take hours to get there.  But honestly whats a couple milliseconds for users like us?

 Grin

Code:
root:# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+216.154.195.60  128.10.252.7     2 u    5   64  377   39.710    3.299   0.593
+dax.tuxfinder.c 145.238.110.68   3 u   50   64  377  120.780    3.110   0.638
*Time4.Stupi.SE  .PPS.            1 u   16   64  377  143.899    0.874   0.476
Logged

ASUS K73 Intel i3 Dual Core 2.3GHz
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!