From 985cd8844419b33463c25205a750f76907876aef Mon Sep 17 00:00:00 2001 From: David James Date: Sun, 21 Aug 2011 10:02:30 -0700 Subject: [PATCH] Add connection timeout to ssh attempts. BUG=chromium-os:19210 TEST=Run a few dozen cbuildbot runs. Change-Id: I276f23135bfe1dfc95575ffd15507cce6fb2461c Reviewed-on: http://gerrit.chromium.org/gerrit/6383 Reviewed-by: Chris Sosa Tested-by: David James --- remote_access.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/remote_access.sh b/remote_access.sh index f454da62f0..7c1b30390e 100644 --- a/remote_access.sh +++ b/remote_access.sh @@ -16,8 +16,8 @@ DEFINE_integer ssh_port 22 \ # Copies $1 to $2 on remote host function remote_cp_to() { REMOTE_OUT=$(scp -P ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY $1 \ - root@$FLAGS_remote:$2) + -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -o ConnectTimeout=120 \ + -i $TMP_PRIVATE_KEY $1 root@$FLAGS_remote:$2) return ${PIPESTATUS[0]} } @@ -25,14 +25,15 @@ function remote_cp_to() { # $2. Directory paths in $1 are collapsed into $2. function remote_rsync_from() { rsync -e "ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY" \ + -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -o ConnectTimeout=120 \ + -i $TMP_PRIVATE_KEY" \ --no-R --files-from=$1 root@${FLAGS_remote}:/ $2 } function remote_sh() { REMOTE_OUT=$(ssh -p ${FLAGS_ssh_port} -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -i $TMP_PRIVATE_KEY \ - root@$FLAGS_remote "$@") + -o UserKnownHostsFile=$TMP_KNOWN_HOSTS -o ConnectTimeout=120 \ + -i $TMP_PRIVATE_KEY root@$FLAGS_remote "$@") return ${PIPESTATUS[0]} }