Re: [chrony-users] Starting Chronyd as online |
[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]
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. Thanks, Paul
# This the default chrony.conf file for the Debian chrony package. After # editing this file use the command 'invoke-rc.d chrony restart' to make # your changes take effect. John Hasler <jhasler@xxxxxxxxxx> 1998-2008 # See www.pool.ntp.org for an explanation of these servers. Please # consider joining the project if possible. If you can't or don't want to # use these servers I suggest that you try your ISP's nameservers. We mark # the servers 'offline' so that chronyd won't try to connect when the link # is down. Scripts in /etc/ppp/ip-up.d and /etc/ppp/ip-down.d use chronyc # commands to switch it on when a dialup link comes up and off when it goes # down. Code in /etc/init.d/chrony attempts to determine whether or not # the link is up at boot time and set the online status accordingly. If # you have an always-on connection such as cable omit the 'offline' # directive and chronyd will default to online. # # Note that if Chrony tries to go "online" and dns lookup of the servers # fails they will be discarded. Thus under some circumstances it is # better to use IP numbers than host names. server 0.debian.pool.ntp.org offline minpoll 8 server 1.debian.pool.ntp.org offline minpoll 8 server 2.debian.pool.ntp.org offline minpoll 8 server 3.debian.pool.ntp.org offline minpoll 8 # Look here for the admin password needed for chronyc. The initial # password is generated by a random process at install time. You may # change it if you wish. keyfile /etc/chrony/chrony.keys # Set runtime command key. Note that if you change the key (not the # password) to anything other than 1 you will need to edit # /etc/ppp/ip-up.d/chrony, /etc/ppp/ip-down.d/chrony, /etc/init.d/chrony # and /etc/cron.weekly/chrony as these scripts use it to get the password. commandkey 1 # I moved the driftfile to /var/lib/chrony to comply with the Debian # filesystem standard. driftfile /var/lib/chrony/chrony.drift # Comment this line out to turn off logging. log tracking measurements statistics logdir /var/log/chrony # Stop bad estimates upsetting machine clock. maxupdateskew 100.0 # Dump measurements when daemon exits. dumponexit # Specify directory for dumping measurements. dumpdir /var/lib/chrony # Let computer be a server when it is unsynchronised. local stratum 10 # Allow computers on the unrouted nets to use the server. allow 10/8 allow 192.168/16 allow 172.16/12 # This directive forces `chronyd' to send a message to syslog if it # makes a system clock adjustment larger than a threshold value in seconds. logchange 0.5 # This directive defines an email address to which mail should be sent # if chronyd applies a correction exceeding a particular threshold to the # system clock. # mailonchange root@localhost 0.5 # This directive tells chrony to regulate the real-time clock and tells it # Where to store related data. It may not work on some newer motherboards # that use the HPET real-time clock. It requires enhanced real-time # support in the kernel. I've commented it out because with certain # combinations of motherboard and kernel it is reported to cause lockups. # rtcfile /var/lib/chrony/chrony.rtc # If the last line of this file reads 'rtconutc' chrony will assume that # the CMOS clock is on UTC (GMT). If it reads '# rtconutc' or is absent # chrony will assume local time. The line (if any) was written by the # chrony postinst based on what it found in /etc/default/rcS. You may # change it if necessary.
Attachment:
init
Description: application/shellscript
Attachment:
signature.asc
Description: This is a digitally signed message part
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |