From 51128a6705ad9f11c1a014a995fca33b0cf42bcd Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Wed, 29 Jul 2015 09:44:27 +0000 Subject: [PATCH] Parallelise the copying of /etc/hosts. --- test/gce.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/gce.sh b/test/gce.sh index 87d08ea6..560c5a3e 100755 --- a/test/gce.sh +++ b/test/gce.sh @@ -81,6 +81,12 @@ EOF ssh -t $name sudo docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter } +function copy_hosts { + hostname=$1 + hosts=$2 + cat $hosts | ssh -t "$hostname" "sudo -- sh -c \"cat >>/etc/hosts\"" +} + # Create new set of VMs function setup { destroy @@ -105,10 +111,11 @@ function setup { sudo sh -c "echo \"$(external_ip $json $name) $hostname\" >>/etc/hosts" try_connect $hostname - # Copy the /etc/hosts we built over - cat $hosts | ssh -t "$hostname" "sudo -- sh -c \"cat >>/etc/hosts\"" + copy_hosts $hostname $hosts & done + wait + rm $hosts $json }