SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yes, the daemon used for syncing computers clocks is called ntp. I suggest running ntp over ntpdate because ntp will adjust for clocks errors whereas ntpdate just sets the time.
As stated it should be part of the default Slackware installation. What version of slack are you running?
Does /etc/ntp.conf or /etc/rc.d/rc.ntpd exist?
tnx, the file:/// link didn't work.... the link to the linux web page did.... so how would i go about setting up cron to automatically update my clock once every 24hrs or so? i've been using linux "part-time" for about 10 years, and "full-time" for only about a year, so there's a lot i still need to learn...
edit: so i created a script called "update-time" with this as the execution line:
/usr/sbin/ntpdate www.worldtime.com
i then placed this file in /etc/cron.daily/
so i gather that this script will execute daily? without using crontab? my pc's clock loses about 1/10 minute per day, and it adds up after a while.
Last edited by unclejed613; 08-08-2010 at 10:07 PM.
tnx, the file:/// link didn't work.... the link to the linux web page did.... so how would i go about setting up cron to automatically update my clock once every 24hrs or so? i've been using linux "part-time" for about 10 years, and "full-time" for only about a year, so there's a lot i still need to learn...
Hmm, that's right; the file:/// link doesn't work. Odd. Oh well, it should point into your installed ntpd documentation. Just remove the leading file:// part.
If you have a permanent connection to the web, then you should just run ntpd and forget about it. See this thread, which actually gives a good set of example configuration files.
But just make an executable script containing...
Code:
#!/bin/sh
/usr/sbin/ntpd -q -x -g
...and drop it into /etc/cron.daily/ to set the clock once a day if that's what you'd really prefer.
Also, www.worldtime.com doesnt appear to accept ntp connections, which you are attempting to do:
Code:
root@foobar:/etc/rc.d# /usr/sbin/ntpdate worldtime.com
9 Aug 15:37:47 ntpdate[7537]: no server suitable for synchronization found
root@foobar:/etc/rc.d# /usr/sbin/ntpdate www.worldtime.com
9 Aug 15:38:10 ntpdate[7548]: no server suitable for synchronization found
root@foobar:/etc/rc.d# /usr/sbin/ntpdate ntp.worldtime.com
Error : Name or service not known
9 Aug 15:40:49 ntpdate[7618]: can't find host ntp.worldtime.com
9 Aug 15:40:49 ntpdate[7618]: no servers can be used, exiting
If you are using Slackware set up your pool servers in /etc/ntpd.conf and make /etc/rc.d/rc.ntpd executable and then run
Code:
/etc/rc.d/rc.ntpd start
(or restart) as root.
This is my /etc/ntpd.conf, which is just the default slackware one with pool servers added:
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
server 0.uk.pool.ntp.org
server 1.uk.pool.ntp.org
server 2.uk.pool.ntp.org
server 3.europe.pool.ntp.org
#
# 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 to anyone else by default (more secure)
restrict default noquery nomodify
# Trust ourselves. :-)
restrict 127.0.0.1
Note I am using UK pool servers. You will want to use pool servers close to you, if possible. Check http://www.pool.ntp.org/en/use.html for details how to do this. If your country has only a couple of pool servers it is better to use the region instead of the country so you don't overtax them. Some regions like Africa have only a few servers as well, so if you are from one of those regions it may be better to specify only 1 or 2 of your servers as a regional one and use worldwide pool servers.
Last edited by Eternal_Newbie; 08-09-2010 at 09:44 AM.
Reason: clarified, extra info
Those links state nothing of the sort that I could see.
Even so, I agree that simply setting up ntpd to run correctly is the better approach; that's what I do.
Sorry I didn't see your reply when I edited my previous post, I'll post what I noticed here as well:
Quote:
Originally Posted by unclejed613
so i created a script called "update-time" with this as the execution line:
/usr/sbin/ntpdate www.worldtime.com
i then placed this file in /etc/cron.daily/
You appear to want to use ntpdate with www.worldtime.com and they don't appear to accept ntp connections:
Code:
root@foobar:/etc/rc.d# /usr/sbin/ntpdate worldtime.com
9 Aug 15:37:47 ntpdate[7537]: no server suitable for synchronization found
root@foobar:/etc/rc.d# /usr/sbin/ntpdate www.worldtime.com
9 Aug 15:38:10 ntpdate[7548]: no server suitable for synchronization found
root@foobar:/etc/rc.d# /usr/sbin/ntpdate ntp.worldtime.com
Error : Name or service not known
9 Aug 15:40:49 ntpdate[7618]: can't find host ntp.worldtime.com
9 Aug 15:40:49 ntpdate[7618]: no servers can be used, exiting
You need you use a valid ntp server for which you often need permission to access, which is why using the pool servers with ntpd is best.
Last edited by Eternal_Newbie; 08-09-2010 at 10:17 AM.
Reason: Clarified again
i'm using the computer for weak signal decoding, which should use at least a stratum 2 server. JT65 signals only need the computer clock to be within a few seconds, but propagation beacons require somewhat better timing, less than a second IIRC.
you're right about www.worldtime.com, it didn't work. i put in www.worldtimeservers.com and that works, as does wwv.nist.gov (that's not a typo, that's WWV, the NIST's standard time and frequency station, which is local to me.
as far as the misuse and abuse part of it goes, i connect once daily at 1am (not midnight, when i imagine a majority of scripts are running), and the address isn't "hard coded" in firmware, and ntpdate doesn't hammer the connection until it gets a reply. i'm not also producing millions of identical devices and flooding the market with them. on an interesting side note, LG blu-ray players and set-top boxes ping www.whitehouse.gov to determine whether they are still connected to the internet at regular intervals. i don't know what the govt did to piss off LG (maybe the goofy stuff that went on with the DTV switchover, such as forcing companies to mass produce DTV/analog STB's, selling them dirt cheap, and taking a huge hit in their R&D budgets?), but every LG product that is internet capable (blu-ray players, DTV STB's, TV's, etc) is periodically pinging www.whitehouse.gov, just to see if it's still conected...
edit: also, i found KDE's crontab editor to be extremely useful, i didn't even need a handful of hastily scribbled notes to get the process set up...
Last edited by unclejed613; 08-09-2010 at 10:18 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.