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 07-25-2012, 06:46 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
/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, 60 views)

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

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
it starts the NTP Daemon
 
Old 07-25-2012, 07:04 PM   #3
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64-15.0
Posts: 103

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, 07:04 PM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

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

Original Poster
Rep: Reputation: 76
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 07:14 PM.
 
Old 07-25-2012, 07:14 PM   #6
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,971

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
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, 07:15 PM   #7
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64-15.0
Posts: 103

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

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
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, 07:26 PM   #9
jamesf
Member
 
Registered: Dec 2004
Location: USA
Distribution: Slackware 12, Slackware64 14.2
Posts: 236
Blog Entries: 1

Rep: Reputation: 57
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 07:28 PM. Reason: more info
 
Old 07-25-2012, 07: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, 07:32 PM   #11
regis_n_bits
Member
 
Registered: Mar 2006
Distribution: Slackware64-15.0
Posts: 103

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, 07:49 PM   #12
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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 07:53 PM.
 
Old 07-25-2012, 08:29 PM   #13
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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, 10:56 PM   #14
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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, 04:11 AM   #15
rouvas
Member
 
Registered: Aug 2006
Location: Greece
Distribution: Slackware.12.2
Posts: 104
Blog Entries: 3

Rep: Reputation: 21
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



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 02:39 PM
ntpd seitan Linux - Software 1 11-29-2004 05:30 AM
ntpd jqcaducifer Linux - General 0 08-21-2003 11:09 PM
ntpd in RH 7.3 melissad Linux - Networking 4 04-28-2003 12:34 PM
ntpd susx Linux - Newbie 3 08-28-2001 04:18 PM

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

All times are GMT -5. The time now is 03:21 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