forked from lordofwizard/mcserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartserver
More file actions
executable file
·66 lines (56 loc) · 2.37 KB
/
startserver
File metadata and controls
executable file
·66 lines (56 loc) · 2.37 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
#!/bin/bash
export MAIN_DIR=$PWD
echo "> Starting the server up. Please wait..."
echo "> Installing Dependencies..."
# Install required dependencies including JDK 21
sudo apt update
sudo apt install -y -qq screen wget openjdk-21-jdk
echo "> Dependencies Installed!"
# Set Java 21 as the default version
echo "> Configuring Java version to JDK 21..."
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-21")
# Verify the Java version
java -version
echo "> Checking Server Type..."
if [ -f $MAIN_DIR/server/bedrock_server ]; then
echo "> Bedrock Server Detected! Starting Server up..."
elif [ ! -f $MAIN_DIR/server/eula.txt ]; then
cd $MAIN_DIR/server
echo "> EULA doesn't exist! Creating one!"
echo "eula=true" > eula.txt
echo "> EULA Completed! Restarting Server"
cd $MAIN_DIR
screen -S server -d -m ./startJavaServer
clear
echo "> Your server is performing a second restart to fix the EULA file."
killall screen
./startserver
exit
elif [ -f $MAIN_DIR/server/eula.txt ]; then
echo "> EULA Detected! Starting Server up..."
else
echo "> Your server isn't set up properly. Force uninstall..."
cd $MAIN_DIR
./uninstall
echo "> Confirmed Uninstallation! Restarting Installation..."
./install
fi
# Prevent multiple instances of the same app from running
killall screen
screen -S server -d -m ./startJavaServer # Starting Java Server
screen -S server -d -m ./startBedrockServer # Starting Bedrock Server
screen -S afk -d -m ./startAfk # Starting AFK app aka bpytop.
screen -S playit -d -m ./startPlayIt # Starting Playit
cd $MAIN_DIR/server
screen -S server -d -m ./bin/php7/bin/php ./PocketMine-MP.phar --no-wizard --disable-ansi # Starting PocketmineMP
screen -S server -d -m java --add-opens java.base/java.nio=io.netty.common --add-exports java.base/jdk.internal.misc=io.netty.common -p modules -m gomint.server/io.gomint.server.Bootstrap # Starting GoMint
cd $MAIN_DIR
echo "-- Your Server is now ONLINE! --"
echo
echo "Type [screen -ls] to check the Running Processes"
echo "Type [screen -r server] to enter the Server Console"
echo "Type [screen -r playit] to view your Server IP"
echo ""
echo "> To stop your server, type './stopserver' to stop"
echo -e '\nChecking if the server has launched properly'
./.checkserver 2> crash.log