From owner-cvs-all@FreeBSD.ORG Mon Jun 13 11:09:40 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5360716A41C; Mon, 13 Jun 2005 11:09:40 +0000 (GMT) (envelope-from joshua@shallow.net) Received: from gold.shallow.net (gold.shallow.net [203.28.8.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB9C043D4C; Mon, 13 Jun 2005 11:09:39 +0000 (GMT) (envelope-from joshua@shallow.net) Received: by gold.shallow.net (Postfix, from userid 1001) id 59098114F4; Mon, 13 Jun 2005 21:09:37 +1000 (EST) Date: Mon, 13 Jun 2005 21:09:37 +1000 From: Joshua Goodall To: Ollivier Robert Message-ID: <20050613110937.GA29004@roughtrade.net> References: <200407201544.i6KFiWWr001296@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: <200407201544.i6KFiWWr001296@repoman.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/ntp Makefile config.h src/usr.sbin/ntp/arlib Makefile src/usr.sbin/ntp/doc Makefile ntp-genkeys.8 src/usr.sbin/ntp/libntp Makefile... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2005 11:09:40 -0000 --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Bit tardy, but ... On Tue, Jul 20, 2004 at 03:44:32PM +0000, Ollivier Robert wrote: > roberto 2004-07-20 15:44:32 UTC > > FreeBSD src repository > > Modified files: > usr.sbin/ntp Makefile config.h > usr.sbin/ntp/doc Makefile > usr.sbin/ntp/libntp Makefile > usr.sbin/ntp/ntpd Makefile > usr.sbin/ntp/ntpdate Makefile > usr.sbin/ntp/ntpdc Makefile > usr.sbin/ntp/ntpq Makefile > usr.sbin/ntp/ntptrace Makefile nitpick: ntptrace should be #!/usr/bin/perl not #!/usr/local/bin/perl or not be a perl script at all! Like the alternative attached. (NB doesn't do reverse lookups unless someone commits bin/79903) thanks Joshua --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=ntptrace #!/bin/sh # usage: ntptrace [-n] [-t timeout] [server] NTPQ=/usr/bin/ntpq GETENT=/usr/sbin/getent BC=/usr/bin/bc TR=/usr/bin/tr dodns=yes timeout=2 lookup() { if [ -z "$dodns" -o ! -x $GETENT ]; then echo $1 return 0 fi $GETENT hosts "$1" | { read addr name aliases if [ ! -z "$name" ]; then echo $name else echo $1 fi } } while getopts "vdnr:t:" option do case $option in n) dodns= ;; t) timeout="${OPTARG}" ;; r|d|v) # ignored, allowed for compatibility ;; *) echo "usage: `basename $0` [-n] [-t timeout] [server]" exit 2 ;; esac done >&2 shift $((OPTIND - 1)) server=${1:-localhost} timeout=$((timeout * 1000)) while true; do stratum=255 qry=`$NTPQ -n -c "timeout ${timeout}" -c rv "${server}" | $TR , '\n'` for i in $qry; do case "$i" in stratum=*) stratum=`echo $i | cut -d= -f2` ;; peer=*) peer=`echo $i | cut -d= -f2` ;; offset=*|phase=*) offset=`echo $i | cut -d= -f2` ;; rootdelay=*) rootdelay=`echo $i | cut -d= -f2` ;; refid=*) refid=`echo $i | cut -d= -f2` ;; *) ;; esac done [ "$stratum" = "255" ] && exit offset=`echo "$offset" / 1000 | $BC -l` rootdelay=`echo "$rootdelay" / 1000 | $BC -l` printf "%s: stratum %d, offset %f, root distance %f" \ "`lookup $server`" "${stratum}" "${offset}" "${rootdelay}" [ "$stratum" = "1" ] && printf ", refid '%s'" "${refid}" echo "" [ "$stratum" = "0" -o "$stratum" = "1" -o "$stratum" = "16" ] && exit case "$refid" in 127.127.*) exit ;; *) ;; esac next="" qry=`$NTPQ -n -c "timeout ${timeout}" -c "pstat ${peer}" "${server}" | $TR , '\n'` for i in $qry; do case "$i" in srcadr=*) next=`echo $i | cut -d= -f2` ;; *) ;; esac done [ -z "$next" ] && exit server=$next done --wRRV7LY7NUeQGEoC--