Hi everyone,
I'm having a hard time locating the solution to what I hope is a
common/simple problem. I'm trying to run a very lengthy process, stop it
about 60 seconds in and retain whatever output has been received at that
point. The process is samba-tng's rpcclient pulling back the eventlog of
a windows NT system. I've tried an eval, and for some reason it's not
timing that out. Anyone have any ideas?
Code is below:
#!/usr/bin/perl -w
use IO::Socket;
STDOUT->autoflush();
my $test;
$SIG{ALRM} = sub { print "$test\n"; die 'died in eval\n'; };
eval {
open(CMD, "/usr/local/samba/bin/rpcclient -S 172.21.173.230 -U
administrator\%itv -c 'eventlog system'|grep -B 2 -A 7 -i dac960nt|grep -e
'[0-9],[0-9],[0-9]'|");
$test = "test.";
#my $total = 20;
while (<CMD>) {
$test .= $_;
#$x++;
#if ($x = $total) {
# close(CMD);
#}
}
print "$test";
alarm(10);
};
--
A single conversation with a wise man is better than ten years of study.
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm