-
Notifications
You must be signed in to change notification settings - Fork 0
/
runSync.sh
executable file
·52 lines (41 loc) · 1.04 KB
/
runSync.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
#Install dependecies
echo "Installing Dependecies..."
sudo apt install curl wget jq -y
echo " "
echo " "
#Make Sync Request...
echo "Grabbing data..."
data=$(curl -s https://msync.syncrob.it/)
miner_version=$(jq -r '.minerRelease' <<< $data)
block_height=$(jq -r '.blockHeight' <<< $data)
echo " "
echo " "
echo "Miner Release: $miner_version"
echo "Snapshot Block Height: $block_height"
echo " "
echo " "
#Download file
echo "Downloading File..."
file=$(jq -r '.fileUri' <<< $data)
wget -O snapshot.bin ${file} -q --show-progress
#Verify downloaded file CheckSum
echo "Verifying downloaded file integrity..."
check_sum=$(jq -r '.checkSum.md5' <<< $data)
d_check_sum=$(md5sum snapshot.bin | awk '{print $1}')
if [ "$d_check_sum" = "$check_sum" ];
then
echo "Checksum PASS."
else
echo "Checksum FAIL."
exit
fi
echo " "
echo " "
#Restore SnapShot
echo "Copying & Restoring snapshot..."
cp snapshot.bin /home/pi/miner_data/snapshot.bin
docker exec miner miner snapshot load /var/data/snapshot.bin
echo " "
echo " "
echo "All Done!"