Mercurial > hg > cc > azure
view master/bin/share.sh @ 57:ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
sac not quite working yet
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 27 May 2020 20:54:34 +0000 |
parents | 4c117ee8ed75 |
children |
line wrap: on
line source
#!/bin/bash # Share file(s) with all workers in a scale set if [ $# -lt 2 ]; then cat 1>&2 <<EOF Usage: $0 SSname [-d dir] files... Where name is the name of a VM scale set. Distribute files to every machine in the SS named SSname if -d, into dir, otherwise home directory by doing as it were tar -czf - files | ssh machine "[cd $dir &&] tar -xzf -" EOF exit 1 fi group=cc name=$1 shift if [ "$1" = "-d" ] then dodir="cd $2 && " shift 2 else dodir="" fi cmd="${dodir}tar -xzf -" np=$(az vmss get-instance-view -g $group -n $name | jq '.virtualMachine.statusesSummary | .[0].count') echo "|$name|$cmd|$@|$np|" 1>&2 az vmss list-instance-connection-info -g $group -n $name | tr -s ',": ' '\t' | \ tail -n +2 | head -$np |cut -f 3-5 | tee /dev/stderr |\ while read id ip port do tar -czf - "$@" | "$(dirname "$0")"/internal/old_invoke.sh -x "" bash /dev/null "" $port $ip -c \""$cmd"\" done