diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index c00ff9b15..a91c7530d 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -214,7 +214,14 @@ sub process_command { # Use the CHID signal to control the #connection number of certain hcp $SIG{CHLD} = sub { my $pid = 0; while (($pid = waitpid(-1, WNOHANG)) > 0) - { $nodes->{$pid_owner{$pid}}{'runprocess'}--; $children--; } }; + { $nodes->{$pid_owner{$pid}}{'runprocess'}--; delete $pid_owner{$pid}; $children--; } }; + + $SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down + foreach (keys %pid_owner) { + kill 9, $_; + } + exit 0; + }; my $hasnode = 1; while ($hasnode) { diff --git a/xCAT-server/sbin/lpar_netboot.expect b/xCAT-server/sbin/lpar_netboot.expect index 9c4ecfead..d9324b2ac 100644 --- a/xCAT-server/sbin/lpar_netboot.expect +++ b/xCAT-server/sbin/lpar_netboot.expect @@ -1798,18 +1798,6 @@ proc Firmware_Dump { device_path phandle } { } } -# -# Signal handling stuff -# -trap { - global PROGRAM - - set signal SIG[trap -name] - - send_user "$PROGRAM: Received signal named '$signal'\n" - exit 3 -} {INT HUP QUIT TERM} - # @@ -2081,6 +2069,17 @@ if [ catch { spawn $CONSOLEBIN $name -f } rsconole_pid ] { set spawn_id_rconsole $spawn_id nc_msg "$PROGRAM Status: spawn_id is $spawn_id\n" +# +# Signal handling stuff +# +trap { + global PROGRAM + set signal SIG[trap -name] + send_user "$PROGRAM: Received signal named '$signal'\n" + exec kill -KILL $spawn_id_rconsole $ssh_spawn_id + exit 3 +} {INT HUP QUIT TERM} + set timeout 10 set pwd_sent 0 send_user "# Connecting to $name\n"