From a shell, I can easily execute the 2nd command (PL) and it will return the percentage of packet loss in the new log file ($TARGET_HOST.PL.log). However, when I run the script, the new log file is created, however there is nothing in it. Any help is appreciated!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 Sept +ember 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:$mi +n:$sec ---------\n\n"; print "Content-type: text/html\n\n"; print "<HTML><PRE>\n"; print "<B>Please wait for script to run, or time out</B>\n"; open (IX,"$commands{$PROGRAM} $TARGET_HOST |"); while (<IX>) { chop $_; print "$_\n"; print LOGFILE "$_\n"; } print <<__END_OF_FOOTER__; </PRE> </HTML> __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/$TAR +GET_HOST.$mday-$shortmonths[$mon]-$longyr.log | cut -d ' ' -f 6 | cut + -d '%' -f1 > /home/***/public_html/packet/logs/$TARGET_HOST.PL.log") +; close (PL);
Node content restored by GrandFather
In reply to File created but blank by diligent
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |