Mercurial > hg > cc > azure
comparison master/bin/internal/invoke.sh @ 9:55e953e5c66f
wrun.sh, invoke.sh:
add control of use of nohup, with -i(mmediately) and -w(ait) respectively
wrun.sh: add support for fixed file input via -ff, handle -ff - in obvious way
wbash.sh: use -ff - and -i to execute shell commands on all workers
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Tue, 02 Oct 2018 10:52:45 +0000 |
parents | a7637c994964 |
children | 2fbefb8d1a9e |
comparison
equal
deleted
inserted
replaced
8:5db6015689a2 | 9:55e953e5c66f |
---|---|
4 # Runs | 4 # Runs |
5 # cmd [id] args... | 5 # cmd [id] args... |
6 # via ssh to ip:port | 6 # via ssh to ip:port |
7 # If ifile is not /dev/null, feed in as stdin | 7 # If ifile is not /dev/null, feed in as stdin |
8 # Unless -x, worker id is passed as first arg | 8 # Unless -x, worker id is passed as first arg |
9 if [ "$1" = "-w" ] | |
10 then | |
11 shift | |
12 wait=1 | |
13 fi | |
9 if [ "$1" = "-x" ] | 14 if [ "$1" = "-x" ] |
10 then | 15 then |
11 shift | 16 shift |
12 id= | 17 id= |
13 me= | 18 me= |
22 shift 6 | 27 shift 6 |
23 echo "#$(date)#$cmd#$ifile#$id#$port#$ip#$@#" 1>&2 | 28 echo "#$(date)#$cmd#$ifile#$id#$port#$ip#$@#" 1>&2 |
24 if [ "$ifile" != "/dev/null" ] | 29 if [ "$ifile" != "/dev/null" ] |
25 then | 30 then |
26 echo "# from $ifile" 1>&2 | 31 echo "# from $ifile" 1>&2 |
27 scp -P $port $ifile $ip:ifile.txt && \ | 32 scp -P $port $ifile $ip:ifile.txt |
33 fi || echo scp failed, status=$? 1>&2 | |
34 if [ "$wait" ] | |
35 then | |
28 ssh -t -p $port $ip "nohup $cmd $id $me ""$@"" > nohup.cc" | 36 ssh -t -p $port $ip "nohup $cmd $id $me ""$@"" > nohup.cc" |
29 else | 37 else |
30 ssh -p $port $ip "$cmd $id $me ""$@" | 38 ssh -p $port $ip "$cmd $id $me ""$@" |
31 fi || echo ssh failed, status=$? 1>&2 | 39 fi || echo ssh failed, status=$? 1>&2 |
32 echo "#$(date)#$id#" 1>&2 | 40 echo "#$(date)#$id#" 1>&2 |