The code below is from a cgi-script from a prior admin. In this sub the section for tail with grep does not display back. It seems the grep command is not working. I did remove the pipe grep from the line to make sure the if logic was working. it will display the logs, but if I try with the grep line and give it a host it will not display. I need a kick start.
##### sub tail_file { my $node = shift; my $command = (); if ($node =~ /all nodes/i) { $command = "tail -100f $logdir/syslog"; }else{ $command = "tail -100f $logdir/syslog | grep -i $node"; } my $count = 0; print "<h2>Tailing /var/log/syslog...</h2><br>\n"; open (TAIL,"$command |") or die "Can't open TAIL($command):$!\n"; while ($count <= $max) { chomp(my $line = <TAIL>); $line =~ s/\s/$space/g; print "$line<br>\n"; $count++; maxed_out() if $count >= $max } } #####
In reply to Too many pipes? by kc6ovd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |