-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrun-remote.sh
executable file
·52 lines (44 loc) · 1.12 KB
/
run-remote.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
i=0
for host in $(<HOSTS); do
hosts[$i]=$host
i=$[i+1]
done
. common.sh
{
for i in $(seq 0 $[N-1]); do
echo $i ${hosts[$i]}
{
ssh ${hosts[$i]} "
for i in static/*.x; do killall ${i#static/}; done
"
rsync -Rltv static/$bin Programs/Bytecode/$prog-* Programs/Schedules/$prog.sch Player-Data/*.{pem,key,0} Player-Data/*Input-* ${hosts[$i]}:
}&
done
} 2>&1 | grep -v 'Permanently added' | grep -v 'no process found'
wait
setup_opts="-h ${hosts[0]} -pn $[RANDOM+1024] -p"
log=$(echo $prog-$(basename $bin) | sed 's/ //g')
test -e logs || mkdir logs
{
for j in $(seq 0 $[N-1]); do
{ while true; do echo; sleep 1; done; } |
ssh ${hosts[$j]} "
c_rehash Player-Data
echo $prefix
$prefix static/$bin $prog $run_opt $setup_opts $j
" 2>&1 | {
logfile=logs/$log-$j
echo logging to $logfile
if true || test $j -eq 0; then
date >> $logfile
tee -a $logfile
date >> $logfile
else
cat >> /dev/null
fi
} & true
done
} 2>&1 | grep -v 'Permanently added' | grep -v 'no process found'
# allow debugging with docker
exit 0