mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-31 00:31:19 +00:00
Fix error when stopping tftp process in AAsn.pm
The check logic that wait for the tftp process can not be finished due to the empty loop. This patch aims to check the status of process group in the loop. close-issue: #1219
This commit is contained in:
@@ -1411,31 +1411,38 @@ sub enable_TFTPhpa
|
||||
|
||||
|
||||
if (-x "/usr/sbin/in.tftpd") {
|
||||
system("killall in.tftpd"); #xinetd can leave behind blocking tftp servers even if it won't start new ones
|
||||
if ($distro =~ /ubuntu.*/i){
|
||||
sleep 1;
|
||||
my @checkproc=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
if (@checkproc){
|
||||
system("stop tftpd-hpa");
|
||||
system("killall in.tftpd"); #xinetd can leave behind blocking tftp servers even if it won't start new ones
|
||||
if ($distro =~ /ubuntu.*/i || $distro =~ /debian.*/i){
|
||||
sleep 1;
|
||||
my @checkproc=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
if (@checkproc){
|
||||
xCAT::Utils->stopservice("tftpd-hpa");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($distro =~ /debian.*/i){
|
||||
sleep 1;
|
||||
my @checkproc=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
if (@checkproc){
|
||||
#system("service tftpd-hpa stop");
|
||||
xCAT::Utils->stopservice("tftpd-hpa");
|
||||
my @tftpprocpids=`ps axf | grep -v 'awk /in.tftpd/' | awk '/in.tftpd/ {print \$1}'`;
|
||||
if (@tftpprocpids) {
|
||||
my %pids_map;
|
||||
my $count = 0;
|
||||
map { chomp; $pids_map{$_} = 1 } @tftpprocpids;
|
||||
while (keys %pids_map) {
|
||||
foreach my $pid (keys %pids_map) {
|
||||
if (xCAT::Utils->is_process_exists($pid)) {
|
||||
$count++;
|
||||
if($count >= 50) {
|
||||
xCAT::MsgUtils->message("S","Error: can not stop tftp process in 5 seconds.");
|
||||
return 1;
|
||||
}
|
||||
sleep 0.1;
|
||||
} else {
|
||||
delete $pids_map{$pid}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
my @tftpprocs=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
while (@tftpprocs) {
|
||||
sleep 0.1;
|
||||
}
|
||||
system("$startcmd");
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
# enable or disable proxydhcp service
|
||||
|
Reference in New Issue
Block a user