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.
This got me motivated to update my own rc.ntp script - could someone please advise how to make a shell-script read the /etc/ntp.conf and grab the preferred server based on the "prefer" statement in the config file:
Code:
server 0.no.pool.ntp.org prefer
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
Ie. scan the prefer keyword on a line beginning with server and thus extract 0.no.pool.ntp.org from this line, and use that server for the initial ntpdate command in the beginning of the rc.ntp script ?
Thanks for your thorough article on Slackware and ntp. Concerning this part of the article
Quote:
Some caveats. The Slackware /etc/rc.d/rc.inet1 initializes the dhcpc daemon such that dhcpcd will overwrite /etc/ntp.conf. Avoid that problem by adding an -N switch to all of the /etc/rc.d/rc.inet1 lines starting the dhcpc daemon. Or, rather then modify the rc.d scripts, edit etc/rc.d/rc.inet1.conf for the affected network card by adding DHCP_KEEPNTP[x]="yes". People using static IP addresses need not worry about this caveat.
I have opted instead to not touch rc.d scripts to handle this, other than rc.local. That way, if any of the other rc scripts change, I don't need to worry about editing them again. First, I save a copy of my edited /etc/ntp.conf file to /etc/ntp.conf.good. Then I put this in /etc/rc.d/rc.local:
I have opted instead to not touch rc.d scripts to handle this, other than rc.local . . .
Good point and thank you for the feedback. One does not need to directly modify the rc.inet1 script at all. I therefore revised that paragraph. Instead simply edit the rc.inet1.conf file, which basically is a container of variables for the rc.inet1 script.
Good point and thank you for the feedback. One does not need to directly modify the rc.inet1 script at all. I therefore revised that paragraph. Instead simply edit the rc.inet1.conf file, which basically is a container of variables for the rc.inet1 script.
I see. I remember thinking about that a while ago and decided I didn't want to have to remember if that particular .conf file was something I would have to examine after an upgradepkg or not. Using rc.local for this just removed one more .conf file I had to deal with. Probably not really the Slack way of doing things, though.
I also start NTP using a script called from rc.local. My script actually copies a known good version of my configuration file with my localised settings to the active configuration file before launching ntpd. I do this as once NTP is up and running, you can easily forget all about about it, until you lose your configuration with a package update or reinstall.
I do remember to check things occasionally with 'ntpd -p' though!
I also start NTP using a script called from rc.local. My script actually copies a known good version of my configuration file with my localised settings to the active configuration file before launching ntpd. I do this as once NTP is up and running, you can easily forget all about about it, until you lose your configuration with a package update or reinstall.
I do remember to check things occasionally with 'ntpd -p' though!
You can just use ntpd -c and not have to copy over anything at all.
would it be perhaps a nice idea to include a logrotate script for ntp as well? not sure how big the ntp.log will become?
secondly, if I want to have other pc's in my lan use my main server for their ntp pooling .. how would I go about that?
I started to write a response for this thread, but by the time I finished I realized I had created sufficient text to revise the how-to. So please revisit Installing NTP for additional instructions. And thanks for the feedback!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.