[ntp:questions] Re: ntp? return value for use in scripts

David Wuertele dave-gnus at bfnet.com
Mon Jan 26 22:58:20 UTC 2004


Harlan> Check out the "ntp-wait" script, in the scripts/ subdir of the
Harlan> distribution for some ideas.

Thanks, I see how I could use this.  I'm still a litte unclear on the
meaning of the "state" word.  For example, the ntp-wait perl script
expects this:

      if (/^state=4/) {
	print "\bOK!\n" if ($opt_v);
	exit 0;
      }

But my ntp-4.2.0 doesn't return "state=4" even though it appears to be
sync'd:

  # /home/mipsel-linux-ntpq -pn
       remote           refid      st t when poll reach   delay   offset  jitter
  ==============================================================================
  +66.187.233.4    .CDMA.           1 u   38   64   77   89.465  529.093 205740.
  +204.152.184.72  204.152.185.13   2 u   42   64   77   19.937  383.231 206871.
  +69.22.157.2     204.34.198.40    2 u   45   64   77   19.959  527.133 204397.
  x150.208.72.154  128.252.19.1     2 u   44 1024   57  109.991  1029.14 450601.
   207.211.160.111 164.67.62.194    2 u  814  512   62   39.969  383.843 1946743
  *216.218.192.202 .GPS.            1 u   39   64   77   38.788  344.754 210607.
  +63.247.194.250  132.163.4.103    2 u   36   64   77   70.000  385.514 208355.
  +128.4.40.12     128.175.60.175   2 u   45   64   77   99.863  387.877 207414.
  -198.72.72.10    140.221.8.88     2 u   40   64   77   79.691  714.577 205001.
  x140.221.9.6     140.221.8.88     2 u   44   64   77   60.002  717.495 203943.
   128.46.108.95   128.46.154.76    4 u   41   64   77  229.705  350.796 207725.
  +216.204.156.2   18.145.0.30      2 u   36   64   77  100.007  389.652 208242.
  +134.84.84.84    160.94.54.248    2 u   48   64   77   69.976  335.238 207574.
  +128.206.12.154  132.163.4.103    2 u   42   64   77   69.991  330.751 205890.
  +192.73.48.1     150.254.183.15   2 u   45   64   77   49.981  382.610 207812.
  # /home/mipsel-linux-ntpq -c "rv 0 state"
  status=06f4 leap_none, sync_ntp, 15 events, event_peer/strat_chg,
  state=3
  # 

I read the ntpq.htm page but there wasn't any description of the
semantics.  Any pointers?

Thanks
Dave




More information about the questions mailing list