O
onlineviewer
Hello All,
I am trying to run a tcpdump and have perl kill the tcpdump once 10
files have been created by the tcpdump. Here is my code, not sure...if
my logic is screwy
Thanks,
system "tcpdump -i bge1 -s0 -w /tmp/file.out -C 1";
sleep 2;
while(true){
@array1 = `ls -l /tmp | grep files`;
$result=@array1+1;
if ($result > 3){
$x=`ps -ef | awk '/tcpdump/ && !/awk/ {print
$2}'`;
@y=split(' ', $x);
$c=$y[1];
system "kill -9 $c";
print "killing tcpdump...";
}else{
print "!!!\n";
exit;
}
exit;
I am trying to run a tcpdump and have perl kill the tcpdump once 10
files have been created by the tcpdump. Here is my code, not sure...if
my logic is screwy
Thanks,
system "tcpdump -i bge1 -s0 -w /tmp/file.out -C 1";
sleep 2;
while(true){
@array1 = `ls -l /tmp | grep files`;
$result=@array1+1;
if ($result > 3){
$x=`ps -ef | awk '/tcpdump/ && !/awk/ {print
$2}'`;
@y=split(' ', $x);
$c=$y[1];
system "kill -9 $c";
print "killing tcpdump...";
}else{
print "!!!\n";
exit;
}
exit;