You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: initialize-db.sh
+36-42Lines changed: 36 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -6,20 +6,18 @@
6
6
# timeout is given by TIMEOUT in seconds (default 1.)
7
7
#
8
8
# Successive backoffs double the timeout.
9
-
functionwith_backoff {
9
+
functionwith_backoff() {
10
10
local max_attempts=${ATTEMPTS-5}
11
11
local timeout=${TIMEOUT-1}
12
12
local attempt=1
13
13
local exitCode=0
14
14
15
-
while(($attempt<$max_attempts))
16
-
do
17
-
if"$@"
18
-
then
15
+
while(($attempt<$max_attempts));do
16
+
if"$@";then
19
17
echo"Bootstrap downloaded creating $DBDIR"
20
18
mkdir -p "$DBDIR"
21
19
echo"Extracting bootstrap to $DBDIR"
22
-
tar -xvf bootstrap.tar.gz -C "$DBDIR"
20
+
tar -xzvf bootstrap.tar.gz -C "$DBDIR"
23
21
rm bootstrap.tar.gz
24
22
echo"Bootstrap extract finish"
25
23
return 0
@@ -29,12 +27,11 @@ function with_backoff {
29
27
30
28
echo"Failure! Retrying in $timeout.."1>&2
31
29
sleep $timeout
32
-
attempt=$((attempt +1))
33
-
timeout=$((timeout *2))
30
+
attempt=$((attempt +1))
31
+
timeout=$((timeout *2))
34
32
done
35
33
36
-
if [[ $exitCode!= 0 ]]
37
-
then
34
+
if [[ $exitCode!= 0 ]];then
38
35
rm -rf /data/chainweb-db/
39
36
echo"Failed for the last time! ($@)"1>&2
40
37
fi
@@ -44,37 +41,34 @@ function with_backoff {
44
41
45
42
DBDIR="/data/chainweb-db/0"
46
43
# Double check if dbdir already exists, only download bootstrap if it doesn't
47
-
if [ -d$DBDIR ]
48
-
then
49
-
echo"Directory $DBDIR already exists, we will not download any bootstrap, if you want to download the bootstrap you need to delete the folder first"
44
+
if [ -d$DBDIR ];then
45
+
echo"Directory $DBDIR already exists, we will not download any bootstrap, if you want to download the bootstrap you need to delete chainweb-db folder first"
50
46
else
51
-
echo"$DBDIR does not exists, lets download the bootstrap"
0 commit comments