File tree 4 files changed +31
-4
lines changed
4 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,16 @@ if [[ ! $2 =~ $number_re ]] ; then
29
29
printf " Invalid <# of Shards> argument: $2 \n"
30
30
exit
31
31
fi
32
+ if [[ $3 -lt 0 ]] || [[ $3 -gt 4 ]]; then
33
+ printf " Invalid <Parent Node Index Begin> argument: $3 \n"
34
+ exit
35
+ fi
32
36
PARENT_NODE_INDEX_BEGIN=$3
33
37
printf " PARENT_NODE_INDEX_BEGIN=$PARENT_NODE_INDEX_BEGIN \n"
38
+ if [[ $4 -lt 0 ]] || [[ $4 -gt 4 ]]; then
39
+ printf " Invalid <Parent Node Index End> argument: $4 \n"
40
+ exit
41
+ fi
34
42
PARENT_NODE_INDEX_END=$4
35
43
printf " PARENT_NODE_INDEX_END=$PARENT_NODE_INDEX_END \n"
36
44
printf " \n"
Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ function deploy_node() {
352
352
353
353
# 5. Wait until node is synced
354
354
printf " \n\n<<< Waiting until node $node_index is synced >>>\n\n"
355
- WAIT_CMD=" gcloud compute ssh $node_target_addr --command 'cd \$ (find /home/ain-blockchain* -maxdepth 0 -type d); . wait_until_node_sync.sh' --project $PROJECT_ID --zone $node_zone "
355
+ WAIT_CMD=" gcloud compute ssh $node_target_addr --command 'cd \$ (find /home/ain-blockchain* -maxdepth 0 -type d); . wait_until_node_sync.sh $node_url ' --project $PROJECT_ID --zone $node_zone "
356
356
printf " WAIT_CMD=$WAIT_CMD \n\n"
357
357
eval $WAIT_CMD
358
358
}
Original file line number Diff line number Diff line change @@ -29,8 +29,16 @@ if [[ ! $2 =~ $number_re ]] ; then
29
29
printf " Invalid <# of Shards> argument: $2 \n"
30
30
exit
31
31
fi
32
+ if [[ $3 -lt 0 ]] || [[ $3 -gt 4 ]]; then
33
+ printf " Invalid <Parent Node Index Begin> argument: $3 \n"
34
+ exit
35
+ fi
32
36
PARENT_NODE_INDEX_BEGIN=$3
33
37
printf " PARENT_NODE_INDEX_BEGIN=$PARENT_NODE_INDEX_BEGIN \n"
38
+ if [[ $4 -lt 0 ]] || [[ $4 -gt 4 ]]; then
39
+ printf " Invalid <Parent Node Index End> argument: $4 \n"
40
+ exit
41
+ fi
34
42
PARENT_NODE_INDEX_END=$4
35
43
printf " PARENT_NODE_INDEX_END=$PARENT_NODE_INDEX_END \n"
36
44
printf " \n"
@@ -339,7 +347,7 @@ function deploy_node() {
339
347
# 5. Wait until node is synced
340
348
printf " \n\n<<< Waiting until node $node_index ($node_target_addr ) is synced >>>\n\n"
341
349
342
- WAIT_CMD=" ssh $node_target_addr 'cd \$ (find /home/${SEASON} /ain-blockchain* -maxdepth 0 -type d); . wait_until_node_sync.sh'"
350
+ WAIT_CMD=" ssh $node_target_addr 'cd \$ (find /home/${SEASON} /ain-blockchain* -maxdepth 0 -type d); . wait_until_node_sync.sh $node_url '"
343
351
printf " \n\nWAIT_CMD=$WAIT_CMD \n\n"
344
352
eval " echo ${node_login_pw} | sshpass -f <(printf '%s\n' ${node_login_pw} ) ${WAIT_CMD} "
345
353
}
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ if [[ $# -lt 1 ]] || [[ $# -gt 1 ]]; then
4
+ printf " Usage: bash wait_until_node_sync.sh <Blockchain Node Url>\n"
5
+ printf " Example: bash wait_until_node_sync.sh http://123.456.789.1:8079\n"
6
+ printf " \n"
7
+ return 1
8
+ fi
9
+
3
10
printf " \n[[[[[ wait_until_node_sync.sh ]]]]]\n\n"
4
11
12
+ # Parse options.
13
+ NODE_URL=" $1 "
14
+ printf " NODE_URL=$NODE_URL \n"
15
+
5
16
printf " \n#### Wait until the new node server catches up ####\n\n"
6
17
7
18
SECONDS=0
16
27
17
28
while :
18
29
do
19
- healthCheck=$( curl -m 20 -X GET -H " Content-Type: application/json" " http://localhost:8080 /health_check" )
30
+ healthCheck=$( curl -m 20 -X GET -H " Content-Type: application/json" " ${NODE_URL} /health_check" )
20
31
printf " \nhealthCheck = ${healthCheck} \n"
21
32
if [[ " $healthCheck " = " true" ]]; then
22
33
printf " \nBlockchain Node server is synced & running!\n"
23
- lastBlockNumber=$( curl -m 20 -X GET -H " Content-Type: application/json" " http://localhost:8080 /last_block_number" | jq -r ' .result' )
34
+ lastBlockNumber=$( curl -m 20 -X GET -H " Content-Type: application/json" " ${NODE_URL} /last_block_number" | jq -r ' .result' )
24
35
printf " \nlastBlockNumber = ${lastBlockNumber} \n"
25
36
printf " \nTime it took to sync in seconds: $SECONDS \n"
26
37
break
You can’t perform that action at this time.
0 commit comments