Mercurial > hg > cc > azure
comparison master/bin/share.sh @ 7:a7637c994964
cull_network.py, parse_load_balance.py, vmss_setup.sh x 2, vmss_create.sh:
From kenneth, slight mods in some cases
share.sh:
Distribute files to workers
wrun.sh, invoke.sh:
From last year, slight mods
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Sun, 30 Sep 2018 20:53:43 +0000 |
parents | |
children | 4c117ee8ed75 |
comparison
equal
deleted
inserted
replaced
6:a3b30e707e83 | 7:a7637c994964 |
---|---|
1 #!/bin/bash | |
2 # Share file(s) with all workers in a scale set | |
3 if [ $# -lt 2 ]; then | |
4 cat 1>&2 <<EOF | |
5 Usage: $0 SSname [-d dir] files... | |
6 Where name is the name of a VM scale set. | |
7 | |
8 Distribute files to every machine in the SS named SSname | |
9 if -d, into dir, otherwise home directory | |
10 by doing as it were | |
11 tar -czf - files | ssh machine "[cd $dir &&] tar -xzf -" | |
12 EOF | |
13 exit 1 | |
14 fi | |
15 group=cc | |
16 name=$1 | |
17 shift | |
18 if [ "$1" = "-d" ] | |
19 then | |
20 dodir="cd $2 && " | |
21 shift 2 | |
22 else | |
23 dodir="" | |
24 fi | |
25 cmd="${dodir}tar -xzf -" | |
26 np=$(az vmss get-instance-view -g $group -n $name | jq '.virtualMachine.statusesSummary | .[0].count') | |
27 echo "|$name|$cmd|$@|$np|" 1>&2 | |
28 az vmss list-instance-connection-info -g $group -n $name | tr -s ',": ' '\t' | \ | |
29 tail -n +2 | head -$np |cut -f 3-5 | tee /dev/stderr |\ | |
30 while read id ip port | |
31 do tar -czf - "$@" | "$(dirname "$0")"/internal/invoke.sh -x "" bash /dev/null "" $port $ip -c \""$cmd"\" | |
32 done | |
33 |