Mercurial > hg > cc > azure
diff master/bin/internal/invoke.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 | 55e953e5c66f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/master/bin/internal/invoke.sh Sun Sep 30 20:53:43 2018 +0000 @@ -0,0 +1,32 @@ +#!/bin/bash +# Helper for ../wrun, q.v. +# Usage: invoke.sh [-x] me cmd ifile id port ip [args...] +# Runs +# cmd [id] args... +# via ssh to ip:port +# If ifile is not /dev/null, feed in as stdin +# Unless -x, worker id is passed as first arg +if [ "$1" = "-x" ] +then + shift + id= + me= +else + me=$1 + id=$4 +fi +cmd="$2" +ifile=$3 +port=$5 +ip=$6 +shift 6 +echo "#$(date)#$cmd#$ifile#$id#$port#$ip#$@#" 1>&2 +if [ "$ifile" != "/dev/null" ] +then + echo "# from $ifile" 1>&2 + scp -P $port $ifile $ip:ifile.txt && \ + ssh -t -p $port $ip "nohup $cmd $id $me ""$@"" > nohup.cc" +else + ssh -p $port $ip "$cmd $id $me ""$@" +fi || echo ssh failed, status=$? 1>&2 +echo "#$(date)#$id#" 1>&2