in reply to Terminating a parallel process opened with "system(..)"
#!/bin/perl -w use strict; use warnings; use Proc::Background; use Net::OpenSSH; my @ports = ("443","8080"); my @threads = ''; my $index = 0; foreach my $port(@ports){ $threads[$index] = Proc::Background->new("/usr/bin/perl thread +.pl $port"); $index++; } my $ssh = Net::OpenSSH->new("remote.host.net", user=>"me",passwd=> +"******"); $ssh->error and die "Can't ssh to host\n"; my @output = $ssh->capture("nmap -p T:8080,443 my.host.name"); print @output; foreach my $thread (@threads){ print "Killing $thread\n"; $thread->die; } print "Done ";
|
|---|