-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple-sync-all.sh
39 lines (30 loc) · 994 Bytes
/
simple-sync-all.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
#!/bin/bash
# simply syncs all natively using ipfs pin add
#Sync all Ravencoin objects up to April 2019 for IPFS node;
# deprecating
#wget -c https://bootstrap.ravenland.org/ipfs.tar; tar -xvf ipfs.tar;cd ipfs; for i in $(ls); do ipfs add "$i"; done;
finish() {
killall simple-sync-all.sh
}
trap finish EXIT
cat banner;
sleep 3
echo "Ravencoin IPFS Swarm + IPFS Mirror Service"; sleep 1;
echo "created by [email protected] (C) 2019"; sleep 1;
curl -L http://bootstrap.ravenland.org/ravencoin_chain_only_$(date +%Y-%m-%d).txt > allipfs
mkdir sync;
cd sync;
rm ../new_missing_hashes.txt
while read -r hash; do
#validate hash isnt present already before downloading
is_valid=$(ipfs pin ls --type=recursive | grep $hash);
echo "checking if $hash already present.."
if [ -z "$is_valid" ]
then
echo "adding $hash to IPFS Mirror store"
ipfs pin add "$hash" &
echo "$hash missing..." >> ../new_missing_hashes.txt
else
echo "We have this file already pinned. Skipping..."
fi
done < ../allipfs