Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2006 19:05:30 +0100
From:      Alex Zbyslaw <xfb52@dial.pipex.com>
To:        Zbigniew Szalbot <zbyszek@szalbot.homedns.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: ntpd with flags in rc.conf
Message-ID:  <452D326A.2030304@dial.pipex.com>
In-Reply-To: <20061011192435.N4855@192.168.11.51>
References:  <20061011192435.N4855@192.168.11.51>

next in thread | previous in thread | raw e-mail | index | archive | help
Zbigniew Szalbot wrote:

> I read this in the handbook:
>
> To ensure the NTP server is started at boot time, add the line 
> ntpd_enable="YES" to /etc/rc.conf. If you wish to pass additional 
> flags to ntpd(8), edit the ntpd_flags parameter in /etc/rc.conf.
>
> Now, I understand that the additional flag may be for example pid (-p 
> /var/run/ntpd.pid).
>
> So how do I put that flag in /etc/rc.conf where I have ntpd_enable="Yes"?
>
Firstly, you should check what default flags there are already.  For 90% 
of apps the defaults will be right for you.  Look in 
/etc/defaults/rc.conf for ntpd_flags and you find:

ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift"

In many instances, the right thing is to *add* to rather than replace 
the default flags.  Let's say you wanted to add a "-g" to the default 
flags for ntpd_flags:

ntpd_flags=${ntpd_flags} -g

That way, if the default flags need to change for some reason, you still 
keep up with the defaults and just add your own local customisation.  If 
you cut-and-paste the default value out of /etc/defaults/rc.conf  then 
you may not notice when that value changes.

--Alex

PS rc.conf is just a shell script, so all variable assignments follow 
the rules you can find in "man sh".  Don't put anything too clever in 
there, though, as this file is read many, many times when the system 
starts up (once per /etc/rc.d/* file at least) so anything like an echo, 
for example, will be executed many times.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?452D326A.2030304>