This repository was archived by the owner on Nov 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
116 lines (108 loc) · 3.25 KB
/
start.sh
File metadata and controls
116 lines (108 loc) · 3.25 KB
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
#!/bin/bash
# config
updateServer="https://github.com/mccivilization/mccivilization-admin-tui.git"
updateServerVer="https://raw.githubusercontent.com/mccivilization/mccivilization-admin-tui/main/version"
localServerVer="./mccivilization-admin-tui/version"
# code
clear
# autoupdate
echo "Checking for new updates"
REMOTE_CONTENT=$(timeout 10 curl -s "$updateServerVer")
RC=$?
if [[ $RC -eq 0 ]]; then
LOCAL_CONTENT=$(cat "$localServerVer")
if (($(echo "$REMOTE_CONTENT") > $(echo "$LOCAL_CONTENT"))); then
echo "Update available"
echo "Updating"
sudo rm -r mccivilization-admin-tui && echo "deleted old ver" && git clone $updateServer && sudo chmod 771 ./mccivilization-admin-tui/* && exec ./mccivilization-admin-tui/start.sh
else
clear
fi
else
echo "Error: Timeout occurred while fetching remote content."
echo
fi
# main while
while :; do
echo -n "Vítej uživateli: "
whoami
echo -n "Právě je: "
date
echo "---------------------------------------"
echo [1] Starting server
echo [2] Stop server
echo [3] Restart server
echo [4] Server status
echo [5] Server console
echo [6] Show installed plugins
echo [7] Change password
echo [0] Exit
read -p 'number: ' command
case $command in
"exit" | "quit" | "0")
exit
;;
"ver" | "version")
echo
echo -n "Version: "
cat $localServerVer
echo
echo
;;
"start" | "1")
sudo systemctl start mccivilization && echo "Server started" && read -p 'Press ENTER to close this message' $null
clear
;;
"stop" | "2")
sudo systemctl stop mccivilization && echo "Server stopped" && read -p 'Press ENTER to close this message' $null
clear
;;
"restart" | "3")
echo "Restarting server..." && sudo systemctl stop mccivilization && sleep 30 && sudo systemctl start mccivilization && echo "Server restarted"
read -p 'Press ENTER to close this message' $null
clear
;;
"status" | "4")
clear
sudo systemctl status mccivilization
read -p 'Press ENTER to close this message' $null
clear
;;
"update")
sudo rm -r mccivilization-adminui-ssh && echo "deleted old ver" && git clone https://github.com/filip2cz/mccivilization-adminui-ssh.git && sudo chmod 771 ./mccivilization-adminui-ssh/* && exec ./mccivilization-adminui-ssh/start.sh
;;
"pwd")
clear
pwd
read -p 'Press ENTER to close this message' $null
;;
"uname")
clear
uname -a
read -p 'Press ENTER to close this message' $null
;;
"top")
top
;;
"console" | "5")
/usr/local/bin/mcrcon -H 127.0.0.1 -P 20656 -p filipjebuh
clear
;;
"plugins" | "6")
clear
sudo echo "Plugins:"
sudo ls /home/filip/mccivilization/plugins | grep .jar
read -p 'Press ENTER to close this message' $null
clear
;;
"passwd" | "7")
passwd && read -p 'Press ENTER to close this message' $null
clear
;;
*)
echo "Unknown number / command"
read -p 'Press ENTER to close this message' $null
clear
;;
esac
done