#!/usr/bin/perl -w

if($#ARGV >= 0)
{
    my $Log = shift(@ARGV);
    
    chomp(my $PID = `grep PID $Log | grep 'Connecting to server' | tail -1`);
    
    $PID =~ s/^.*PID (\d+) Connecting to server.*$/$1/;
    
    print "Killing $PID\n";
    
    `kill $PID`;
}
else
{
    print STDERR "killwab <wab.log>\nKills the wab that made the logfile specified.\n";
}
