-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathtbw.sh
135 lines (119 loc) · 2.44 KB
/
tbw.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
#!/bin/bash
# A menu driven shell script sample template
## ----------------------------------
# Step #1: Define variables
# ----------------------------------
# ----------------------------------
# Step #2: User defined function
# ----------------------------------
pause(){
read -p "Press [Enter] key to continue..." fackEnterKey
}
install_modules(){
sudo apt-get install python3-pip
sudo apt-get install python3-dev python3-venv python3-wheel
sudo apt-get install libudev-dev libusb-1.0.0-dev
sudo apt-get install build-essential
sudo apt-get install autoconf
sudo apt-get install libtool
sudo apt-get install pkgconf
sudo apt-get install libpq-dev
pip3 install setuptools
pip3 install wheel
pip3 install -r requirements.txt
}
install(){
install_modules
pause
}
initialize(){
version=$(python3 -c "import sys; print(''.join(map(str, sys.version_info[:2])))")
if [[ "$version" -lt 36 ]]; then
echo "Python 3.6 minimum version is required"
exit 1
fi
cd core
python3 tbw.py
cd ..
pause
}
all(){
cd core
pm2 start apps.json
cd ..
pause
}
tbw(){
cd core
pm2 start apps.json --only tbw
cd ..
pause
}
pay(){
cd core
pm2 start apps.json --only pay
cd ..
pause
}
custom(){
cd core
pm2 start apps.json --only custom
cd ..
pause
}
pool(){
cd core
pm2 start apps.json --only pool
cd ..
pause
}
stop(){
cd core
pm2 stop apps.json
cd ..
pause
}
# function to display menus
show_menus() {
clear
echo "~~~~~~~~~~~~~~~~~~~~~"
echo " M A I N - M E N U"
echo "~~~~~~~~~~~~~~~~~~~~~"
echo "1. Install"
echo "2. Initialize"
echo "3. Start All"
echo "4. Start TBW Only"
echo "5. Start Pay Only"
echo "6. Start Custom Only"
echo "7. Start Pool Only"
echo "8. Stop All"
echo "9. Exit"
}
read_options(){
local choice
read -p "Enter choice [ 1 - 9] " choice
case $choice in
1) install ;;
2) initialize ;;
3) all ;;
4) tbw ;;
5) pay ;;
6) custom ;;
7) pool ;;
8) stop ;;
9) exit 0;;
*) echo -e "${RED}Error...${STD}" && sleep 2
esac
}
# ----------------------------------------------
# Step #3: Trap CTRL+C, CTRL+Z and quit singles
# ----------------------------------------------
trap '' SIGINT SIGQUIT SIGTSTP
# -----------------------------------
# Step #4: Main logic - infinite loop
# ------------------------------------
while true
do
show_menus
read_options
done