comparison master/bin/internal/old_invoke.sh @ 33:4c117ee8ed75

fixDates, _fixAndMerge, _doFetch towards rework of date fixup share.sh, old_invoke.sh recover the old approach to sharing, which works
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 20 Nov 2018 14:49:07 +0000
parents
children
comparison
equal deleted inserted replaced
32:9342f6269edf 33:4c117ee8ed75
1 #!/bin/bash
2 # Helper for ../wrun, q.v.
3 # Usage: invoke.sh [-x] me cmd ifile id port ip [args...]
4 # Runs
5 # cmd [id] args...
6 # via ssh to ip:port
7 # If ifile is not /dev/null, feed in as stdin
8 # Unless -x, worker id is passed as first arg
9 if [ "$1" = "-w" ]
10 then
11 shift
12 wait=1
13 fi
14 if [ "$1" = "-x" ]
15 then
16 shift
17 id=
18 me=
19 else
20 me=$1
21 id=$4
22 fi
23 cmd="$2"
24 ifile=$3
25 port=$5
26 ip=$6
27 shift 6
28 echo "#$(date)#$cmd#$ifile#$id#$port#$ip#$@#" 1>&2
29 if [ "$ifile" != "/dev/null" ]
30 then
31 echo "# from $ifile" 1>&2
32 scp -P $port $ifile $ip:ifile.txt
33 fi || echo scp failed, status=$? 1>&2
34 if [ "$wait" ]
35 then
36 ssh -tt -p $port $ip "nohup $cmd $id $me ""$@"" > nohup.cc"
37 else
38 ssh -p $port $ip "$cmd $id $me ""$@"
39 fi || echo ssh failed, status=$? 1>&2
40 echo "#$(date)#$id#" 1>&2