my @days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my @shortdays = qw( Sun Mon Tue Wed Thu Fri Sat ); my @months = qw(January February March April May June July August September October November December); my @shortmonths = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); my ( $sec, $min, $hr, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); my $longyr = $year + 1900; my $fixmo = $mon + 1; $LOGFILE = ">/home/***/public_html/packet/logs/$TARGET_HOST.$mday-$shortmonths[$mon]-$longyr.log"; open(LOGFILE) || die "Log file will not open.\n"; print LOGFILE "--------- $mday $shortmonths[$mon], $longyr, $hr:$min:$sec ---------\n\n"; print "Content-type: text/html\n\n"; print "
\n";
print "Please wait for script to run, or time out\n";
open (IX,"$commands{$PROGRAM} $TARGET_HOST |");
while ()
{
chop $_;
print "$_\n";
print LOGFILE "$_\n";
}
print <<__END_OF_FOOTER__;
__END_OF_FOOTER__
close (IX);
$PACKET = ">/home/***/public_html/packet/logs/$TARGET_HOST.PL.$mday-$shortmonths[$mon]-$longyr.log";
open(PACKET) || die "Packet loss file will not open.\n";
open (PL,"grep 'packet loss' /home/***/public_html/packet/logs/$TARGET_HOST.$mday-$shortmonths[$mon]-$longyr.log | cut -d ' ' -f 6 | cut -d '%' -f1 > /home/***/public_html/packet/logs/$TARGET_HOST.PL.log");
close (PL);