forked from eloots/Pi-Akka-Cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy
executable file
·34 lines (27 loc) · 977 Bytes
/
copy
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
#!/bin/bash
######################################################################
#
# Copy jar for a given exercise to all nodes or a specific single node
#
# Usage:
# ./copy exercise_nr [node-nr]
#
# Set CLUSTER_NR to the number of the cluster you're working with
# Default value of CLUSTER_NR is 0
######################################################################
CLUSTER_NR_SEL=${CLUSTER_NR:-0}
CLUSTER_BASE_NODE_NR=$(expr $CLUSTER_NR_SEL \* 5)
PI_USER=akkapi
EXERCISE_NR=`printf %03d $1`
FATJAR=`ls exercise*${EXERCISE_NR}*/target/scala-2.12/exercise*${EXERCISE_NR}*jar`
if [ -f exercise*${EXERCISE_NR}*/target/cinnamon-agent.jar ];then
CINNAMON=`ls exercise*${EXERCISE_NR}*/target/cinnamon-agent.jar`
fi
ALL_NODES="0 1 2 3 4"
SELECTED_NODE=$2
NODES=${SELECTED_NODE:-$ALL_NODES}
for i in $NODES;do
node=$[ CLUSTER_BASE_NODE_NR + i ]
echo "Copy $FATJAR $CINNAMON to node-${node}"
scp $FATJAR ${CINNAMON-} ${PI_USER}@node-${node}:/home/${PI_USER}
done