mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
build-remote.pl: Properly close the SSH connection between attempts
This commit is contained in:
parent
be0b9dda31
commit
3a0cc43ac8
2 changed files with 5 additions and 3 deletions
|
@ -44,6 +44,7 @@ sub closeSSHConnection {
|
||||||
if ($sshStarted) {
|
if ($sshStarted) {
|
||||||
system("ssh $sshHost @sshOpts -O exit 2> /dev/null") == 0
|
system("ssh $sshHost @sshOpts -O exit 2> /dev/null") == 0
|
||||||
or warn "unable to stop SSH master: $?";
|
or warn "unable to stop SSH master: $?";
|
||||||
|
$sshStarted = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,9 +195,10 @@ REQ: while (1) {
|
||||||
# Connect to the selected machine.
|
# Connect to the selected machine.
|
||||||
@sshOpts = ("-i", $machine->{sshKeys}, "-x");
|
@sshOpts = ("-i", $machine->{sshKeys}, "-x");
|
||||||
$hostName = $machine->{hostName};
|
$hostName = $machine->{hostName};
|
||||||
last REQ if
|
if (openSSHConnection($hostName)) {
|
||||||
openSSHConnection($hostName) &&
|
last REQ if system("ssh $hostName @sshOpts nix-builds-inhibited < /dev/null > /dev/null 2>&1") != 0;
|
||||||
system("ssh $hostName @sshOpts nix-builds-inhibited < /dev/null > /dev/null 2>&1") != 0;
|
closeSSHConnection;
|
||||||
|
}
|
||||||
|
|
||||||
warn "unable to open SSH connection to $hostName, trying other available machines...\n";
|
warn "unable to open SSH connection to $hostName, trying other available machines...\n";
|
||||||
$machine->{enabled} = 0;
|
$machine->{enabled} = 0;
|
||||||
|
|
Loading…
Reference in a new issue