File:  [LON-CAPA] / loncom / debugging_tools / get_version.pl
Revision 1.2: download - view: text, annotated - select for diffs
Tue Oct 17 15:00:07 2006 UTC (17 years, 6 months ago) by albertel
Branches: MAIN
CVS tags: version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_99_1, version_2_2_99_0, HEAD
i- don't wiat forever for the page to come

open(HOST,"<$ARGV[0]");
my $i++;
my %vers;
my %done;
while(my $line=<HOST>) {
    if ($line=~/^\#/) { next; }
    my $host=(split(':',$line))[3];
    chomp($host);
    if (!$host || exists($done{$host})) { next; }
    $done{$host}=1;
    print($host." -> ");
    my $ver=`curl --max-time 15 --connect-timeout 5 -s http://$host/adm/login | grep -- -200 | tr ">" "\n" | tail -1 `;
    $ver=~s/&nbsp;//g;
    $ver=~s/ //g;
    if ($ver eq "") { print("\n"); }
    print($ver);
    $ver=~s/\s//g;
    push(@{$vers{$ver}},$host);
#    if ($i++==14) { last; }
}

foreach my $key (sort(keys(%vers))) {
    print($key." -> \n");
    print("     ".join("\n     ",@{$vers{$key}})."\n");
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>