forked from shermand100/PiNodeXMR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-explorer.sh
124 lines (103 loc) · 4.7 KB
/
update-explorer.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "Start setup-update-explorer.sh script $(date)" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
#(1) Define variables and updater functions
#Permission Setting
chmod 755 /home/pinodexmr/current-ver-exp.sh 2> >(tee -a /home/pinodexmr/debug.log >&2)
chmod 755 /home/pinodexmr/exp-new-ver.sh 2> >(tee -a /home/pinodexmr/debug.log >&2)
#Load Variables
. /home/pinodexmr/current-ver-exp.sh 2> >(tee -a /home/pinodexmr/debug.log >&2)
. /home/pinodexmr/exp-new-ver.sh 2> >(tee -a /home/pinodexmr/debug.log >&2)
#Load boot status - what condition was node last run
. /home/pinodexmr/bootstatus.sh 2> >(tee -a /home/pinodexmr/debug.log >&2)
#Stop Node to make system resources available.
sudo systemctl stop blockExplorer.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroPrivate.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroMiningNode.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroTorPrivate.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroTorPublic.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroPublicFree.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroI2PPrivate.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroCustomNode.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
sudo systemctl stop moneroPublicRPCPay.service 2> >(tee -a /home/pinodexmr/debug.log >&2)
echo "Monero node stop command sent to make system resources available for update, allowing 30 seconds for safe shutdown"
sleep "30"
echo "Deleting Old Version"
rm -rf /home/pinodexmr/onion-monero-blockchain-explorer/ 2> >(tee -a /home/pinodexmr/debug.log >&2)
sleep "2"
echo -e "\e[32mBuilding Monero Blockchain Explorer[0m"
echo -e "\e[32m*******************************************************\e[0m"
echo -e "\e[32m***This will take a few minutes - Hardware Dependent***\e[0m"
echo -e "\e[32m*******************************************************\e[0m"
sleep 10
git clone -b master https://github.com/moneroexamples/onion-monero-blockchain-explorer.git 2> >(tee -a /home/pinodexmr/debug.log >&2)
cd onion-monero-blockchain-explorer
mkdir build && cd build
cmake .. 2> >(tee -a /home/pinodexmr/debug.log >&2)
make 2> >(tee -a /home/pinodexmr/debug.log >&2)
cd
#Update system reference Explorer version number version number
echo "#!/bin/bash
CURRENT_VERSION_EXP=$NEW_VERSION_EXP" > /home/pinodexmr/current-ver-exp.sh
#Define Restart Monero Node
# Key - BOOT_STATUS
# 2 = idle
# 3 || 5 = private node || mining node
# 4 = tor
# 6 = Public RPC pay
# 7 = Public free
# 8 = I2P
# 9 tor public
if [ $BOOT_STATUS -eq 2 ]
then
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Node ready for start. See web-ui at $(hostname -I) to select mode." 16 60
fi
if [ $BOOT_STATUS -eq 3 ]
then
sudo systemctl start moneroPrivate.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
if [ $BOOT_STATUS -eq 4 ]
then
sudo systemctl start moneroTorPrivate.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
if [ $BOOT_STATUS -eq 5 ]
then
sudo systemctl start moneroMiningNode.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
if [ $BOOT_STATUS -eq 6 ]
then
sudo systemctl start moneroPublicRPCPay.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
if [ $BOOT_STATUS -eq 7 ]
then
sudo systemctl start moneroPublicFree.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
if [ $BOOT_STATUS -eq 8 ]
then
sudo systemctl start moneroI2PPrivate.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
if [ $BOOT_STATUS -eq 9 ]
then
sudo systemctl start moneroTorPublic.service
whiptail --title "Block Explorer Update Complete" --msgbox "Update complete, Your Monero Node has resumed." 16 60
fi
rm /home/pinodexmr/new-ver-exp.sh 2> >(tee -a /home/pinodexmr/debug.log >&2)
##End debug log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "End setup-update-explorer.sh script $(date)" 2>&1 | tee -a /home/pinodexmr/debug.log
echo "
####################
" 2>&1 | tee -a /home/pinodexmr/debug.log