@@ -5,34 +5,34 @@ echo "Downloading snpashot"
5
5
6
6
cd /data
7
7
8
- BASE_SNAPSHOT_FILE_NAME=snalshot .tar.gz
8
+ BASE_SNAPSHOT_FILE_NAME=snapshot .tar.gz
9
9
BASE_SNAPSHOT_DIR=/data/
10
10
BASE_SNAPSHOT_DOWNLOAD_STATUS=-1
11
- BASE_LATEST_SNAPSHOT_FILE_NAME=$( curl https://$NETWORK_ID -$NODE_CONFIG -snapshots.base.org/latest)
12
11
13
12
if [ " $SNAPSHOT_URL " == " none" ] || [ -z " ${SNAPSHOT_URL} " ]; then
13
+ BASE_LATEST_SNAPSHOT_FILE_NAME=$( curl https://$NETWORK_ID -$NODE_CONFIG -snapshots.base.org/latest)
14
14
SNAPSHOT_URL=https://$NETWORK_ID -$NODE_CONFIG -snapshots.base.org/$BASE_LATEST_SNAPSHOT_FILE_NAME
15
15
fi
16
16
17
17
while (( BASE_SNAPSHOT_DOWNLOAD_STATUS != 0 ))
18
18
do
19
- PIDS=$( pgrep aria2c )
19
+ PIDS=$( pgrep wget )
20
20
if [ -z " $PIDS " ]; then
21
- aria2c -x3 $SNAPSHOT_URL -d $BASE_SNAPSHOT_DIR -o $BASE_SNAPSHOT_FILE_NAME -l aria2c.log --log-level=warn --allow-piece-length-change=true
21
+ wget --continue --retry-connrefused --waitretry=66 --read-timeout=20 --output-document $BASE_SNAPSHOT_DIR / $BASE_SNAPSHOT_FILE_NAME -o download.log -t 0 $SNAPSHOT_URL
22
22
fi
23
23
BASE_SNAPSHOT_DOWNLOAD_STATUS=$?
24
- pid=$( pidof aria2c )
24
+ pid=$( pidof wget )
25
25
wait $pid
26
- echo " aria2c exit."
26
+ echo " wget exit."
27
27
case $BASE_SNAPSHOT_DOWNLOAD_STATUS in
28
+ 2)
29
+ echo " CLI parsing error. Check variables."
30
+ exit 2
31
+ ;;
28
32
3)
29
- echo " file not exist ."
33
+ echo " File I/O error ."
30
34
exit 3
31
35
;;
32
- 9)
33
- echo " No space left on device."
34
- exit 9
35
- ;;
36
36
* )
37
37
continue
38
38
;;
@@ -45,14 +45,14 @@ sleep 60
45
45
# take about 2 hours to decompress the snapshot
46
46
echo " Decompression snapshot start ..."
47
47
48
- tar -I zstdmt -xf $BASE_SNAPSHOT_DIR /$BASE_SNAPSHOT_FILE_NAME -C /data 2>&1 | tee unzip.log && echo " decompression success ..." || echo " decompression failed..." >> snapshots-decompression.log
49
- echo " Decompressing snapshot success ..."
48
+ tar -zxvf $BASE_SNAPSHOT_DIR /$BASE_SNAPSHOT_FILE_NAME -C /data 2>&1 | tee unzip.log && echo " decompresed successfully ..." || echo " decompression failed..." >> snapshots-decompression.log
49
+ echo " Decompresed snapshot ..."
50
50
51
51
mv /data/snapshots/$NETWORK_ID /download/* /data && \
52
52
rm -rf /data/snapshots && \
53
53
rm -rf /data/$BASE_SNAPSHOT_FILE_NAME
54
54
55
- echo " Snapshot is ready !!! "
55
+ echo " Processed snapshot "
56
56
57
57
chown -R bcuser:bcuser /data && \
58
58
sudo su bcuser && \
0 commit comments