mirror of
https://github.com/nix-community/nixos-anywhere.git
synced 2024-08-16 20:00:36 +03:00
ssh: use timout only for waiting
This commit is contained in:
parent
650b6db62c
commit
b7c4b74bf9
@ -59,9 +59,12 @@ while [[ $# -gt 0 ]]; do
|
||||
done
|
||||
|
||||
# ssh wrapper
|
||||
ssh_() {
|
||||
timeout_ssh_() {
|
||||
timeout 10 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$ssh_connection" "$@"
|
||||
}
|
||||
ssh_() {
|
||||
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$ssh_connection" "$@"
|
||||
}
|
||||
|
||||
# first check if the remote system is kexec booted
|
||||
if $(ssh_ -- test -e /etc/is-kexec); then
|
||||
@ -91,7 +94,7 @@ export TMPDIR=/root/kexec
|
||||
setsid /root/kexec/kexec/run
|
||||
SSH
|
||||
# wait for machine to become unreachable
|
||||
while ssh_ -- exit 0; do sleep 1; done
|
||||
while timeout_ssh_ -- exit 0; do sleep 1; done
|
||||
|
||||
# watiting for machine to become available again
|
||||
until ssh_ -o ConnectTimeout=10 -- exit 0; do sleep 5; done
|
||||
|
Loading…
Reference in New Issue
Block a user