forked from multiversx/mx-chain-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sh
executable file
·267 lines (218 loc) · 4.57 KB
/
script.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/bin/bash
set -e
#Make script aware of its location
SCRIPTPATH="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
source $SCRIPTPATH/config/variables.cfg
source $SCRIPTPATH/config/functions.cfg
source $SCRIPTPATH/config/menu_functions.cfg
#Check if there are newer versions of the scripts available
check_scripts_version
#See if the user has passed any command line arguments and if not show the menu
if [ $# -eq 0 ]
then
show_menu #Show all the menu options
COLUMNS=18
PS3="Please select an action:"
options=("install" "observing_squad" "multikey_group" "upgrade" "upgrade_multikey" "upgrade_squad" "upgrade_proxy" "remove_db" "start" "start_all" "stop" "stop_all" "cleanup" "github_pull" "add_nodes" "get_logs" "benchmark" "quit")
select opt in "${options[@]}"
do
case $opt in
'install')
install
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'observing_squad')
observers
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'multikey_group')
multikey
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'upgrade')
#Check if running a squad
if [ -e $CUSTOM_HOME/.squad_install ]; then
echo -e "${GREEN}--> Redirecting to the ${CYAN}upgrade_squad${GREEN} option.${NC}"
echo -e
upgrade_squad
else
upgrade
fi
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'upgrade_multikey')
upgrade_squad
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'upgrade_squad')
upgrade_squad
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'upgrade_proxy')
upgrade_proxy
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'remove_db')
remove_db
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'start')
start
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'start_all')
start_all
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'stop')
stop
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'stop_all')
stop_all
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'cleanup')
cleanup
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'github_pull')
github_pull
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'add_nodes')
add_node
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'get_logs')
get_logs
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'benchmark')
run_benchmark
echo -e
read -n 1 -s -r -p " Process finished. Press any key to continue..."
clear
show_menu
;;
'quit')
echo -e
echo -e "${GREEN}---> Exiting scripts menu...${NC}"
echo -e
break
;;
esac
done
else
case "$1" in
'install')
install
;;
'observing_squad')
observers
;;
'multikey_group')
multikey
;;
'upgrade')
##Check if running a squad
if [ -e $CUSTOM_HOME/.squad_install ]; then
echo -e "${GREEN}--> Redirecting to the ${CYAN}upgrade_squad${GREEN} option.${NC}"
echo -e
upgrade_squad
else
upgrade
fi
;;
'upgrade_multikey')
upgrade_squad
;;
'upgrade_squad')
upgrade_squad
;;
'upgrade_proxy')
upgrade_proxy
;;
'remove_db')
remove_db
;;
'start')
start
;;
'start_all')
start_all
;;
'stop')
stop
;;
'stop_all')
stop_all
;;
'cleanup')
cleanup
;;
'github_pull')
github_pull
;;
'add_nodes')
add_node
;;
'get_logs')
get_logs
;;
'benchmark')
run_benchmark
;;
'migrate')
migrate_scripts
;;
esac
fi