head	1.1;
branch	1.1.1;
access;
symbols
	RELENG_9_1_0_RELEASE:1.1.1.2
	RELENG_9_1:1.1.1.2.0.54
	RELENG_9_1_BP:1.1.1.2
	RELENG_8_3_0_RELEASE:1.1.1.2
	RELENG_8_3:1.1.1.2.0.52
	RELENG_8_3_BP:1.1.1.2
	RELENG_9_0_0_RELEASE:1.1.1.2
	RELENG_9_0:1.1.1.2.0.50
	RELENG_9_0_BP:1.1.1.2
	RELENG_9:1.1.1.2.0.48
	RELENG_9_BP:1.1.1.2
	RELENG_7_4_0_RELEASE:1.1.1.2
	RELENG_8_2_0_RELEASE:1.1.1.2
	RELENG_7_4:1.1.1.2.0.46
	RELENG_7_4_BP:1.1.1.2
	RELENG_8_2:1.1.1.2.0.44
	RELENG_8_2_BP:1.1.1.2
	RELENG_8_1_0_RELEASE:1.1.1.2
	RELENG_8_1:1.1.1.2.0.42
	RELENG_8_1_BP:1.1.1.2
	RELENG_7_3_0_RELEASE:1.1.1.2
	RELENG_7_3:1.1.1.2.0.40
	RELENG_7_3_BP:1.1.1.2
	RELENG_8_0_0_RELEASE:1.1.1.2
	RELENG_8_0:1.1.1.2.0.38
	RELENG_8_0_BP:1.1.1.2
	RELENG_8:1.1.1.2.0.36
	RELENG_8_BP:1.1.1.2
	RELENG_7_2_0_RELEASE:1.1.1.2
	RELENG_7_2:1.1.1.2.0.34
	RELENG_7_2_BP:1.1.1.2
	RELENG_7_1_0_RELEASE:1.1.1.2
	RELENG_6_4_0_RELEASE:1.1.1.2
	RELENG_7_1:1.1.1.2.0.32
	RELENG_7_1_BP:1.1.1.2
	RELENG_6_4:1.1.1.2.0.30
	RELENG_6_4_BP:1.1.1.2
	RELENG_7_0_0_RELEASE:1.1.1.2
	RELENG_6_3_0_RELEASE:1.1.1.2
	RELENG_7_0:1.1.1.2.0.28
	RELENG_7_0_BP:1.1.1.2
	RELENG_6_3:1.1.1.2.0.26
	RELENG_6_3_BP:1.1.1.2
	RELENG_7:1.1.1.2.0.24
	RELENG_7_BP:1.1.1.2
	RELENG_6_2_0_RELEASE:1.1.1.2
	RELENG_6_2:1.1.1.2.0.22
	RELENG_6_2_BP:1.1.1.2
	RELENG_5_5_0_RELEASE:1.1.1.2
	RELENG_5_5:1.1.1.2.0.20
	RELENG_5_5_BP:1.1.1.2
	RELENG_6_1_0_RELEASE:1.1.1.2
	RELENG_6_1:1.1.1.2.0.18
	RELENG_6_1_BP:1.1.1.2
	RELENG_6_0_0_RELEASE:1.1.1.2
	RELENG_6_0:1.1.1.2.0.16
	RELENG_6_0_BP:1.1.1.2
	RELENG_6:1.1.1.2.0.14
	RELENG_6_BP:1.1.1.2
	RELENG_5_4_0_RELEASE:1.1.1.2
	RELENG_5_4:1.1.1.2.0.12
	RELENG_5_4_BP:1.1.1.2
	RELENG_4_11_0_RELEASE:1.1.1.1
	RELENG_4_11:1.1.1.1.0.20
	RELENG_4_11_BP:1.1.1.1
	RELENG_5_3_0_RELEASE:1.1.1.2
	RELENG_5_3:1.1.1.2.0.10
	RELENG_5_3_BP:1.1.1.2
	RELENG_5:1.1.1.2.0.8
	RELENG_5_BP:1.1.1.2
	RELENG_4_10_0_RELEASE:1.1.1.1
	RELENG_4_10:1.1.1.1.0.18
	RELENG_4_10_BP:1.1.1.1
	RELENG_5_2_1_RELEASE:1.1.1.2
	RELENG_5_2_0_RELEASE:1.1.1.2
	RELENG_5_2:1.1.1.2.0.6
	RELENG_5_2_BP:1.1.1.2
	RELENG_4_9_0_RELEASE:1.1.1.1
	RELENG_4_9:1.1.1.1.0.16
	RELENG_4_9_BP:1.1.1.1
	RELENG_5_1_0_RELEASE:1.1.1.2
	RELENG_5_1:1.1.1.2.0.4
	RELENG_5_1_BP:1.1.1.2
	RELENG_4_8_0_RELEASE:1.1.1.1
	RELENG_4_8:1.1.1.1.0.14
	RELENG_4_8_BP:1.1.1.1
	RELENG_5_0_0_RELEASE:1.1.1.2
	RELENG_5_0:1.1.1.2.0.2
	RELENG_5_0_BP:1.1.1.2
	RELENG_4_7_0_RELEASE:1.1.1.1
	RELENG_4_7:1.1.1.1.0.12
	RELENG_4_7_BP:1.1.1.1
	RELENG_4_6_2_RELEASE:1.1.1.1
	RELENG_4_6_1_RELEASE:1.1.1.1
	RELENG_4_6_0_RELEASE:1.1.1.1
	RELENG_4_6:1.1.1.1.0.10
	RELENG_4_6_BP:1.1.1.1
	RELENG_4_5_0_RELEASE:1.1.1.1
	RELENG_4_5:1.1.1.1.0.8
	RELENG_4_5_BP:1.1.1.1
	RELENG_4_4_0_RELEASE:1.1.1.1
	RELENG_4_4:1.1.1.1.0.6
	RELENG_4_4_BP:1.1.1.1
	RELENG_4_3_0_RELEASE:1.1.1.1
	RELENG_4_3:1.1.1.1.0.4
	RELENG_4_3_BP:1.1.1.1
	RELENG_4_2_0_RELEASE:1.1.1.1
	RELENG_4_1_1_RELEASE:1.1.1.1
	PRE_SMPNG:1.1.1.1
	RELENG_4_1_0_RELEASE:1.1.1.1
	RELENG_4_0_0_RELEASE:1.1.1.1
	RELENG_4:1.1.1.1.0.2
	RELENG_4_BP:1.1.1.1
	v4_0_99b:1.1.1.1
	v4_0_98f:1.1.1.1
	DMILLS:1.1.1;
locks; strict;
comment	@# @;


1.1
date	99.12.09.13.01.03;	author roberto;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.12.09.13.01.03;	author roberto;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2002.10.29.20.11.45;	author roberto;	state dead;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@#!/usr/local/bin/perl 
#!/usr/local/bin/perl -d
# 
# This script compares the time of several machines with the
# time on the local host.
#
# Use or modify it as you wish. 
#
# As the original author is only expecting 14 minutes of fame, 
# leaving his name attached would be appreciated.
#
# R. Gary Cutbill <rgary@@chrysalis.com>
# 21 April 1999
#
$tol=2.0;
$|=1;
print "Time Check";

open(HOSTS,"ypcat hosts.byaddr |");  # get a list of hosts from the yp server.

while ($line=<HOSTS>) { # loop for each host getting the offset compared to localhost
	($addr,$host,$aliases)=split(/\s+/,$line,3);
        $res=`/usr/local/bin/ntptrace -m 1 -r 1 -t 1 $host`;
	print ".";
	chop $res;
        push (@@results,$res);
}
print "\n";


#
# Sort the list of hosts, and print out there offsets
# from the local host.  
#
@@list=sort appropriately @@results;
foreach $i ( @@list ) {

   @@dargs=split(/\s+/,$i);
   if ( $dargs[1] eq "\*Timeout\*" ) { 
     print "$i\n";
     chop $dargs[0];
     push(@@down,$dargs[0]);
   } else {
     printf "%-25s %7s %3s %6s %10s %5s %8s %8s\n",@@dargs;
     if ( ( $dargs[4] > $tol ) || ( $dargs[4] < -$tol ) ) { 
	 chop $dargs[0];
         push(@@toofarout,$dargs[0]); }
   }
}
#
# When the above list finishes, hosts that are different by +/- $tol (two seconds)
# are in @@toofarout.  Hosts that are down are in @@down. They are treated the same
# way here, but you might want to do something different depending on your site.
#
# print a set of suggested rsh commands to run on the hosts that 
# don't have "good" time.   "restartntp" is left as an excersize to the reader.
# I usually use it to kill a running xntpd, ntpdate some server, and the start xntp
# again.
# 
print "\nConsider:\n";
foreach $i ( (@@down,@@toofarout) ) {
    print "  rsh $i sudo restartntp\n";
}


#
# sort the results from the list.  First by stratum, then by time deviation
# Put hosts that didn't respond (timed out) on the bottom.
#
sub appropriately {
    @@af=split(/\s+/,$a);
    @@bf=split(/\s+/,$b);
    $aba= ($af[4]<0)?-$af[4]:$af[4];
    $abb= ($bf[4]<0)?-$bf[4]:$bf[4];

        ( $af[1] ne $bf[1] ) ? $bf[1] cmp $af[1] :
	   ( ( $af[2] != $bf[2] ) ? ( $bf[2] <=> $af[2] ) :
	     ( ( $aba != $abb )  ? ( $abb <=> $aba ) : ($af[0] cmp $bf[0] ) ) );
}
@


1.1.1.1
log
@Virgin import of ntpd 4.0.98f
@
text
@@


1.1.1.2
log
@Remove files not present in 4.1.1a import.
@
text
@@

