LinuxQuestions.org
Register a domain and help support LQ
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 07-25-2012, 07:46 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,276

Rep: Reputation: 49
/etc/rc.d/rc.ntpd: what does it do?


Hi:

In /etc/rc.d/rc.M I have this:
Code:
# Start the Network Time Protocol daemon:
if [ -x /etc/rc.d/rc.ntpd ]; then
  sh /etc/rc.d/rc.ntpd start
fi
What does this do? It seems a daemon by its name. I attach /etc/rc.d/rc.ntpd. Anything to do with keeping time in tthe system?

Slackware 12.0
Attached Files
File Type: txt rc.ntpd.txt (561 Bytes, 8 views)

Last edited by stf92; 07-25-2012 at 07:50 PM.
 
Old 07-25-2012, 08:01 PM   #2
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,621

Rep: Reputation: 445Reputation: 445Reputation: 445Reputation: 445Reputation: 445
it starts the NTP Daemon
 
Old 07-25-2012, 08:04 PM   #3
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64 14.1 (kernel 3.14.4)
Posts: 83

Rep: Reputation: Disabled
Yes, the rc.ntpd is the init script to start the NTP daemon. And the configuration file for NTP is /etc/ntp.conf.

If you don't want the NTP daemon to start just remove the execute permission on the /etc/rc.d/rc.ntpd file.
 
Old 07-25-2012, 08:04 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,276

Original Poster
Rep: Reputation: 49
But I run ntpdate ntp.pool.org every day!
 
Old 07-25-2012, 08:11 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,276

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by stf92 View Post
But I run ntpdate ntp.pool.org every day!
I mean. I do not know what the NTP daemon does? Could you tell me?

The fact is that the time in my system lags, even running ntpdate almost every day. It is not the hardware timer.

Last edited by stf92; 07-25-2012 at 08:14 PM.
 
Old 07-25-2012, 08:14 PM   #6
chrisretusn
Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware
Posts: 508

Rep: Reputation: Disabled
If you are running ntpdate everyday, the the NTP daemon should NOT be used. Run ntpdate with the NTP daemon running will result in:
Code:
ntpdate pool.org
26 Jul 08:08:55 ntpdate[14694]: the NTP socket is in use, exiting
I have the NTP daemon running. One of my computers is the time server, the rest of them on my LAN update from that.
 
Old 07-25-2012, 08:15 PM   #7
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64 14.1 (kernel 3.14.4)
Posts: 83

Rep: Reputation: Disabled
That is OK - as long as the NTP daemon is not running.
 
Old 07-25-2012, 08:17 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,154

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
ntpdate will update the clock once when executed. ntp updates the clock at frequent intervals in small increments (except for the possibility at inital start up) so processes do not see a time jump and it also adjusts for system and hardware clock drift.
 
Old 07-25-2012, 08:26 PM   #9
jamesf
Member
 
Registered: Dec 2004
Location: USA
Distribution: Slackware 12 and higher
Posts: 229

Rep: Reputation: 51
If you haven't modified /etc/ntp.conf and the execute bit is set for /etc/rc.ntpd then ntpd is simply syncing with the local hardware clock.

All PC hardware clocks drift and the drift cannot be detected without an external source to sync to.

I've modified my /etc/ntpd.conf like this (the ntpd docs recommend at least 3 external sources in the list from which ntpd picks):
Code:
#
# NTP server (list one or more) to synchronize with:
#server pool.ntp.org iburst

server 0.us.pool.ntp.org iburst
server 1.us.pool.ntp.org iburst
server 2.us.pool.ntp.org iburst
server 3.us.pool.ntp.org iburst
Then I set chmod +x /etc/rc.d/rc.ntpd and my time syncs automatically. You can use 'ntpq -p' to show which time server ntpd is synced to (shown with a '*'), but realize that it takes a few minutes for a time server to be chosen after every boot.

Try http://www.pool.ntp.org/en/ for more information and pool addresses for continents and countries.

EDIT: http://pool.ntp.org is some blog about the tour de france, or something. Odd. With the www. in front the relevant site is shown.

Last edited by jamesf; 07-25-2012 at 08:28 PM. Reason: more info
 
Old 07-25-2012, 08:29 PM   #10
lolnameless
LQ Newbie
 
Registered: Jan 2012
Location: Hong Kong
Distribution: Slackware
Posts: 18

Rep: Reputation: Disabled
the name says it all, why cant you search it :/?
would be better if you ask whether it's useless or not
 
Old 07-25-2012, 08:32 PM   #11
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64 14.1 (kernel 3.14.4)
Posts: 83

Rep: Reputation: Disabled
Well if the time on your box keeps lagging, you may want to try using the NTP daemon.

The configuration is in the /etc/ntp.conf file. You can try replacing the "server" line(s) with some NTP servers in Argentina for example (see http://www.pool.ntp.org/zone/ar):

Code:
server 1.ar.pool.ntp.org    iburst
server 3.south-america.pool.ntp.org    iburst
server 0.south-america.pool.ntp.org    iburst
Then run:
Code:
chmod +x /etc/rc.d/rc.ntpd
sh /etc/rc.d/rc.ntpd start
You can use the "ntpq -pn" command to see the status of the NTP daemon. If you see an asterisk beside the IP address, that signifies that the time is "synced" with that server. It may take about 5 to 10 minutes before you see the time being "synched".

And don't bother trying to run the ntpdate command while the ntp daemon is running.
 
Old 07-25-2012, 08:49 PM   #12
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,276

Original Poster
Rep: Reputation: 49
I was studing /etc/rc.d/rc.M, to know all the script that are run at boot time. When I saw the lines I quoted in post #1, I was surprised. Somebody in LQ had told me to run ntpdate, probably without knowing the precise circumstances.

Now I think I know what happens. The system clock lags on the one hand, and running, once in a while ntpdate did not cause an exit (post #6). It follows, I think, that the daemon is not updating the clock! But see how rc.M does find rc.ntpd. Then, rc.ntpd is to blame. I attached (post #1) a copy of it. Plus,

Code:
semoi@darkstar:~$ ps -e|grep ntp
 2975 ?        00:00:01 ntpd
semoi@darkstar:~$

Last edited by stf92; 07-25-2012 at 08:53 PM.
 
Old 07-25-2012, 09:29 PM   #13
ReaperX7
Senior Member
 
Registered: Jul 2011
Location: California
Distribution: LFS-7.6, Slackware 14.1, FreeBSD 10.1
Posts: 3,836
Blog Entries: 15

Rep: Reputation: 1188Reputation: 1188Reputation: 1188Reputation: 1188Reputation: 1188Reputation: 1188Reputation: 1188Reputation: 1188Reputation: 1188
Basically when you have a server-client environment the NTP Daemon acts as a "time server" much like other known time-web servers.

MSN and several other major web hubs host time clock servers to allow PCs to keep their clocks updated. I think Microsoft may still operate time.microsoft.com which is one that I've used in the past because it's well known.
 
Old 07-25-2012, 11:56 PM   #14
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,578

Rep: Reputation: 468Reputation: 468Reputation: 468Reputation: 468Reputation: 468
Quote:
Originally Posted by stf92 View Post
I was studing /etc/rc.d/rc.M, to know all the script that are run at boot time. When I saw the lines I quoted in post #1, I was surprised. Somebody in LQ had told me to run ntpdate, probably without knowing the precise circumstances.

Now I think I know what happens. The system clock lags on the one hand, and running, once in a while ntpdate did not cause an exit (post #6). It follows, I think, that the daemon is not updating the clock! But see how rc.M does find rc.ntpd. Then, rc.ntpd is to blame. I attached (post #1) a copy of it.
If you always have access to the internet on your box, then you probably should configure and run ntpd. The start script will do the initial "I don't care how off my clock is, make it be on time NOW!" clock adjustment and then do its best to keep the clock on the system match the rest of the world's view of "now".

If you have intermittent access to the internet, then you should simply run "ntpd -q -g -x" periodically (especially after you start up and have access to the internet). (ntpdate is deprecated.)

Code:
man ntpd
will tell you all sorts of interesting things. Pointing your browser at one of the html files in /usr/doc/ntp-4.2.6p3/html/ will also provide lots of good info. (Or whatever version of ntpd you've got.)
 
1 members found this post helpful.
Old 07-26-2012, 05:11 AM   #15
rouvas
Member
 
Registered: Aug 2006
Location: Greece
Distribution: Slackware.12.2
Posts: 85
Blog Entries: 2

Rep: Reputation: 6
Although I use ntpd, out of curiosity I lookep up the "-x" option from the man page:

"-x
Normally, the time is slewed if the offset is less than the step threshold, which is 128 ms by default, and stepped if above the threshold. This option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually. Note: Since the slew rate of typical Unix kernels is limited to 0.5 ms/s, each second of adjustment requires an amortization interval of 2000 s. Thus, an adjustment as much as 600 s will take almost 14 days to complete. This option can be used with the -g and -q options. See the tinker command for other options. Note: The kernel time discipline is disabled with this option"

Frankly, I don't understand a bit!
What is "slew rate"?
What is the meaning of "..each second of adjustment requires an amortization interval of 2000 s..."?
Does all this means that if I "ntpd -g -q -x" It will tkae upto 14 days for the clock to be corrected?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
NTPd slackamp Slackware 1 12-26-2006 03:39 PM
ntpd seitan Linux - Software 1 11-29-2004 06:30 AM
ntpd jqcaducifer Linux - General 0 08-22-2003 12:09 AM
ntpd in RH 7.3 melissad Linux - Networking 4 04-28-2003 01:34 PM
ntpd susx Linux - Newbie 3 08-28-2001 05:18 PM


All times are GMT -5. The time now is 08:08 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration