-
Notifications
You must be signed in to change notification settings - Fork 49
/
ak-setup.sh
100 lines (89 loc) · 2.83 KB
/
ak-setup.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
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
function install_monitor_fe() {
wget -O setup-monitor-fe.sh "https://raw.githubusercontent.com/akile-network/akile_monitor/refs/heads/main/setup-monitor-fe.sh"
chmod +x setup-monitor-fe.sh
./setup-monitor-fe.sh
}
function install_monitor() {
wget -O setup-monitor.sh "https://raw.githubusercontent.com/akile-network/akile_monitor/refs/heads/main/setup-monitor.sh"
chmod +x setup-monitor.sh
./setup-monitor.sh
}
function uninstall_monitor() {
systemctl stop ak_monitor
systemctl disable ak_monitor
rm -f /etc/systemd/system/ak_monitor.service
rm -rf /etc/ak_monitor
systemctl daemon-reload
echo "Monitor backend uninstalled"
}
function view_monitor_config() {
if [ -f /etc/ak_monitor/config.json ]; then
cat /etc/ak_monitor/config.json
else
echo "Monitor config not found"
fi
}
function install_client() {
echo "Please provide client installation parameters:"
read -p "Enter auth_secret: " auth_secret
read -p "Enter URL: " url
read -p "Enter name: " name
wget -O setup-client.sh "https://raw.githubusercontent.com/akile-network/akile_monitor/refs/heads/main/setup-client.sh"
chmod +x setup-client.sh
./setup-client.sh "$auth_secret" "$url" "$name"
}
function uninstall_client() {
systemctl stop ak_client
systemctl disable ak_client
rm -f /etc/systemd/system/ak_client.service
rm -rf /etc/ak_monitor
systemctl daemon-reload
echo "Client uninstalled"
}
function view_client_config() {
if [ -f /etc/ak_monitor/client.json ]; then
cat /etc/ak_monitor/client.json
else
echo "Client config not found"
fi
}
while true; do
echo " _ _ _ _ __ __ _ _ "
echo " / \ | | _(_) | ___ | \/ | ___ _ __ (_) |_ ___ _ __ "
echo " / _ \ | |/ / | |/ _ \ | |\/| |/ _ \| '_ \| | __/ _ \| '__|"
echo " / ___ \| <| | | __/ | | | | (_) | | | | | || (_) | | "
echo "/_/ \_\_|\_\_|_|\___| |_| |_|\___/|_| |_|_|\__\___/|_| "
echo " "
echo "=================================================="
echo "AkileCloud Monitor 管理脚本 Powered by KunBuFenZi"
echo "=================================================="
echo "0.安装主控前端"
echo "1.安装主控后端"
echo "2.卸载主控后端"
echo "3.查看主控config"
echo "4.安装被控"
echo "5.卸载被控"
echo "6.查看被控config"
echo "7.退出"
echo "============================================="
read -p "Please select an option (0-7): " choice
case $choice in
0) install_monitor_fe ;;
1) install_monitor ;;
2) uninstall_monitor ;;
3) view_monitor_config ;;
4) install_client ;;
5) uninstall_client ;;
6) view_client_config ;;
7) exit 0 ;;
*) echo "Invalid option" ;;
esac
echo
read -p "Press Enter to continue..."
clear
done