Re: [chrony-users] Starting Chronyd as online

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


On Mon, 2 Jul 2012, Paul Menzel wrote:

Am Sonntag, den 01.07.2012, 23:37 -0700 schrieb Bill Unruh:
On Sun, 1 Jul 2012, Bill Unruh wrote:

On Mon, 2 Jul 2012, Paul Menzel wrote:

 Am Sonntag, den 01.07.2012, 22:55 -0700 schrieb Bill Unruh:
 On Mon, 2 Jul 2012, Paul Menzel wrote:

 is there a way to start Chronyd as online with an option?

 This would be helpful to simplify init.d scripts or service files not
 having to read the password from the key file and pass some commands
 to
 Chronyc.

 No idea what you mean of why having chronyd "online" ( O assume not
 detached
 as a daemon) would help. You would still need to run chronyc to pass
 commands
 to the running daemon, and would have to read the password file to send
 certain commands. And how it would simplify init.d scripts I have no
 idea.
 Perhaps if you told us the problem, rather than the solution, we could
 be more
 helpful.

 Currently starting Chronyd and executing `activity` in Chronyc all
 sources (NTP servers) are listed as offline. The command `online` has to
 be executed to get those online. I would like to start Chronyd, so that
 all sources are online right away.

OK, it should not do that if your network is up and you have not told it to
put them all offline in /etc/chrony.conf.

Strange. But this is definitely the behavior I am seeing. The shipped
init.d script also contains the following lines to send the `online`
command.

       $ more /etc/init.d/chrony
       […]
       putonline ()
       { # Do we have a default route?  If so put chronyd online.
           if timelimit -q -s9 -t5 -- netstat -rn 2>/dev/null | grep -q '0\.0\.0\.0'
           then
       	sleep 2  # Chronyd can take a while to start.
       	KEY=$(awk '$1 ~ /^commandkey$/ { print $2; exit}' /etc/chrony/chrony.conf)
       	PASSWORD=`awk '$1 ~ /^'$KEY'$/ {print $2; exit}' /etc/chrony/chrony.keys`
       	# Make sure chronyc can't hang us up.
       	if timelimit -q -s9 -t5 -- /usr/bin/chronyc > /dev/null << EOF
       password $PASSWORD
       online
       burst 5/10
       quit
       EOF
               then
                       touch /var/run/chrony-ppp-up
                       echo "$NAME is running and online."
               else
                       rm -f /var/run/chrony-ppp-up
                       echo "$NAME is running and offline."
               fi
           else
               rm -f /var/run/chrony-ppp-up
               echo "$NAME is running and offline."
           fi
       }

       case "$1" in
           start)
       	start-stop-daemon --start --verbose --exec $DAEMON
       	case "$?" in
       		0) # daemon successfully started
       			putonline
       			;;
       […]

a) check chrony.conf to see if it is telling chrony to put the sources
offline. If chrony.conf is doing that remove the offline keywords in
chorny.conf.

b) Is your network up when chrony comes up? If you have to have chrony start
before the network comes up, then you could put in an init.d script to
restart
chronyd after the network is up

Actually cancel b) Even if the network is down when chrony starts the sources
should come up and be online when the network comes up. At least it does that
on my laptop, where I have to connect to the network well after chronyd comes
up. Perhaps you should post your chrony.conf file and tell us which version of
chrony you are running.

I am using Chrony 1.26 from Debian Sid/unstable. Please find my
`chrony.conf` file attached which is the one shipped in the Debian
package.

Yes. it is a lunatic chrony.conf file:-)
Anyway, if y ou read it you will see that all of the server lines have
"offline" in them. Remove those offline words from the server lines.

Note that because you are using names rather than IP addresses, it may be
problematic if the network is not up when chronyd is started (not sure but I
suspect it should not matter) but try without that offline and see if things
work. If you network is down when chronyd is started, and it does not connect
when the network comes up, then do service chronyd restart after the network comes up.

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/