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

Notices


Reply
  Search this Thread
Old 05-12-2006, 01:13 PM   #1
stitchman
Member
 
Registered: Dec 2005
Distribution: Slackware 13.1
Posts: 82

Rep: Reputation: 15
How do I use timeservers?


My laptop seems to lose a few minutes everyweek while running, how do i use the time servers to automatically sync my time with a more accurate source? A command line way of doing this is preferred, GUI's are for web browsing and watching movies
 
Old 05-12-2006, 01:22 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
On debian I installed ntp (or ntpclient) and then set the config file to sync to a server on the web. Not sure if it comes by default on slackware or whether you need to find a package online...
 
Old 05-12-2006, 01:50 PM   #3
Fluxx
Member
 
Registered: Aug 2005
Location: Bavaria, Germany
Distribution: Slackware (Current)
Posts: 225

Rep: Reputation: 30
I added a line to my /etc/rc.d/rc.local:

Code:
netdate time.fu-berlin.de &
Then with every boot process the time is syncronized with this timeserver (Germany). Add your timeserver and enjoy ...

Fluxx.
 
Old 05-12-2006, 02:44 PM   #4
stitchman
Member
 
Registered: Dec 2005
Distribution: Slackware 13.1
Posts: 82

Original Poster
Rep: Reputation: 15
I figured out a good way to do it, i made a script /etc/cron.daily/date to run netdate ntp0.cornell.edu so that should run every day right?
 
Old 05-12-2006, 04:31 PM   #5
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
I highly recommend a quick read of the materials available at www.ntp.org. An in-depth knowledge of Internet and network timekeeping is not necessary for keeping your laptop's time set accurately, but a quick read-through of the materials available at that site will give you a good overview.

There is also a list of publicly available timeservers which you can use to keep you system clock accurate. By using more than one clock, you can gain greater accuracy. (But then again, if you are a millisecond off, who's going to know?!)

Anyway, I run netdate as a cron job on a desktop system. With your laptop, which probably gets booted more often, an entry in rc.local listing one server is probably sufficient.
 
Old 05-12-2006, 06:23 PM   #6
PDock
Member
 
Registered: Aug 2004
Distribution: Slack10 & curr. tried numerous
Posts: 189

Rep: Reputation: 37
Or if you don't want to always knock on the same door (with possibly larger skews from getting a distant server from the pool). Add this line to your laptops /etc/rc.d/rc.local.
Code:
/usr/sbin/ntpdate -v us.pool.ntp.org
 
Old 05-12-2006, 07:31 PM   #7
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Rep: Reputation: 50
/etc/ntp.conf
Code:
# Sample /etc/ntp.conf:  Configuration file for ntpd.
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
#server	127.127.1.0	# local clock
#fudge	127.127.1.0 stratum 10	

#
# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
#driftfile /etc/ntp/drift
#multicastclient			# listen on default 224.0.1.1
#broadcastdelay	0.008

#
# Keys file.  If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will.
#
#keys		/etc/ntp/keys
#trustedkey	65535
#requestkey	65535
#controlkey	65535

# Don't serve time or stats or trust anyone else by default (more secure)
#restrict default noquery notrust nomodify
# Trust ourselves.  :-)
#restrict 127.0.0.1
#
#
# Here's what Shilo came up with
#restrict default noquery notrust nomodify
restrict default kod notrap nomodify nopeer noquery
#restrict 127.0.0.1
restrict 127.0.0.1
#restrict 192.168.0.0 mask 255.255.255.0
restrict 192.168.0.0 mask 255.255.255.0 kod notrap nomodify nopeer
#fudge 127.127.1.0 stratum 3
#server 127.127.1.0
driftfile /etc/ntp.drift
logfile /var/log/ntp.log
server us.pool.ntp.org
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
Add to /etc/rc.d/rc.local
Code:
# Start ntpd to keep time updated. Added by Shilo 9/5/2004
/usr/bin/echo "Updating Time: /usr/sbin/ntpdate us.pool.ntp.org. 0.us.pool.ntp.org. 1.us.pool.ntp.org."
/usr/sbin/ntpdate us.pool.ntp.org. 0.us.pool.ntp.org. 1.us.pool.ntp.org.
/usr/bin/echo "Starting Network Time Protocol Daemon: /usr/sbin/ntpd"
/usr/sbin/ntpd
Alternatively, you can use the above snippet to make a more Slackware-like rc script.

Note that this is for US servers. Adjust accordingly. Also, this is most appropriate for a system that always has a network conection.

Last edited by shilo; 05-12-2006 at 07:33 PM.
 
  


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



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

All times are GMT -5. The time now is 10:39 AM.

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