mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-29 15:51:18 +00:00
Task 46440 Cleanup the nmap process for switchdiscover command
This commit is contained in:
@@ -627,6 +627,16 @@ sub nmap_scan {
|
||||
}
|
||||
}
|
||||
|
||||
# handle ctrl-c
|
||||
$SIG{TERM} = $SIG{INT} = sub {
|
||||
#clean up the nmap processes
|
||||
my $nmap_pid = `ps -ef | grep nmap | grep -v grep | awk '{print \$2}'`;
|
||||
if ($nmap_pid) {
|
||||
system("kill -9 $nmap_pid >/dev/null 2>&1");
|
||||
exit 0;
|
||||
}
|
||||
};
|
||||
|
||||
$ccmd = "/usr/bin/nmap -sP -oX - @$ranges";
|
||||
my $result = xCAT::Utils->runcmd($ccmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
|
Reference in New Issue
Block a user