view master/bin/bindWorkerVars.sh @ 54:1099246f22b6

new scripts
author Henry S. Thompson <ht@markup.co.uk>
date Fri, 08 Feb 2019 17:46:49 +0000
parents
children
line wrap: on
line source

# Usage . bindWorkerVars.sh name
# (Re)init worker environment vars
name=$1
f=$HOME/.parallel/$name
rm -f $f
az vmss list-instance-connection-info -g cc -n $name | tr -s ',": ' '\t' | \
    tail -n +2 | fgrep instance |cut -f 4,5 | \
  while read ip port
   do
    echo ssh -p $port $ip >> $f
   done
ip=$(head -1 $f | cut -f 4 -d ' ')
export $name=$ip
export WORKERS=$name
sed '/export WORKERS/s/=.*$/='$name'/;/WORKERS names/s/ .*=[^ ]* / '$name'='$ip' /' -i $HOME/.bashrc
echo $name=$ip