forked from Hser2bio/Reex-MN
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mnbootstrap.sh
92 lines (68 loc) · 2.22 KB
/
mnbootstrap.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# Make sure unzip is installed
clear
apt-get -qq update
apt -qqy install unzip
clear
echo "This script will bootstrap your masternode."
read -rp "Press Ctrl-C to abort or any other key to continue. " -n1 -s
clear
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root."
exit 1
fi
if [ -e /etc/systemd/system/Reecore.service ]; then
systemctl stop Reecore.service
else
su -c "reecore-cli stop" "root"
fi
echo "Refreshing node, please wait."
sleep 5
rm -rf "/root/.Reecore/blocks"
rm -rf "/root/.Reecore/chainstate"
rm -rf "/root/.Reecore/sporks"
rm -rf "/root/.Reecore/peers.dat"
echo "Installing bootstrap file..."
cd /root/.Reecore && wget --no-check-certificate https://github.com/reecore-coin/Reex-MN/releases/download/012020/bootstrap.dat
if [ -e /etc/systemd/system/Reecore.service ]; then
sudo systemctl start Reecore.service
else
su -c "reecored -daemon" "root"
fi
echo "Starting REEX, will check status in 60 seconds..."
sleep 60
clear
if ! systemctl status Reecore.service | grep -q "active (running)"; then
echo "ERROR: Failed to start Reex. Please re-install using install script."
exit
fi
echo "Waiting for wallet to load..."
until su -c "reecore-cli getinfo 2>/dev/null | grep -q \"version\"" "$USER"; do
sleep 1;
done
clear
echo "Your masternode is syncing. Please wait for this process to finish."
echo "This can a few minutes. Do not close this window."
echo ""
until [ -n "$(reecore-cli getconnectioncount 2>/dev/null)" ]; do
sleep 1
done
until su -c "reecore-cli mnsync status 2>/dev/null | grep '\"IsBlockchainSynced\": true' > /dev/null" "$USER"; do
echo -ne "Current block: $(su -c "reecore-cli getblockcount" "$USER")\\r"
sleep 1
done
clear
cat << EOL
Now, you need to start your masternode. If you haven't already, please add this
node to your masternode.conf now, restart and unlock your desktop wallet, go to
the Masternodes tab, select your new node and click "Start Alias."
EOL
read -rp "Press Enter to continue after you've done that. " -n1 -s
clear
sleep 1
su -c "/usr/local/bin/reecore-cli startmasternode local false" "$USER"
sleep 1
clear
su -c "/usr/local/bin/reecore-cli masternode status" "$USER"
sleep 5
echo "" && echo "Masternode refresh completed." && echo ""