start/stop script
start script „.sh“ datei anlegen z.b: ServerStartBedrock.sh
#!/bin/sh
#
# Minecraft server startup script
# Revision 1.0
# Created by ZiggidyZ, Jan 10, 2023
# Script works on Ubuntu Server 20.04.5 LTS
#
#
####################################################################################
#
#The directory where your minecraft server folders are located
SOURCE=/opt/minecraft/bedrock
#
#The number of servers which will be running, they need to all be named below as SERVERX where X is the server number
NUMSERVERS=2
#
#The name of each server which is running
SERVER1=bedrock-server1
SERVER2=bedrock-server2
#
# For loop that starts each server
for ((X=1; X<="$NUMSERVERS"; X++)); do
#
declare -n SERVER=SERVER$X
#
#Checks to see if the screen session already exists
CHECK=`screen -list | grep -o $SERVER`
if [ $SERVER == $CHECK ]
then
echo "$SERVER is already running"
else
#If not already running the screen session is opened and the server is started
screen -A -m -d -L -Logfile "$SOURCE/$SERVER/Logs/$SERVER.log" -S $SERVER
screen -S $SERVER -p 0 -X stuff "cd $SOURCE/$SERVER^M"
screen -S $SERVER -p 0 -X stuff "LD_LIBRARY_PATH=. ./bedrock_server^M"
screen -rD $SERVER -X multiuser on
screen -rD $SERVER -X acladd root
fi
done
im terminal jenachdem, pfad anpassen wo start script abgelegt wurde
bash /opt/minecraft/ServerStartBedrock.sh
stop script „.sh“ datei anlegen z.b: ServerStopBedrock.sh
#!/bin/sh
#
# Minecraft server startup script
# Revision 1.0
# Created by ZiggidyZ, Jan 10, 2023
# Script works on Ubuntu Server 20.04.5 LTS
#
#
####################################################################################
#
#The directory where your minecraft server folders are located
SOURCE=/opt/minecraft/bedrock
#
#The number of servers which will be running, they need to all be named below as SERVERX where X is the server number
NUMSERVERS=2
#
#The name of each server which is running
SERVER1=bedrock-server1
SERVER2=bedrock-server2
#
# For loop that starts each server
for ((X=1; X<="$NUMSERVERS"; X++)); do
#
declare -n SERVER=SERVER$X
#
#Checks to see if the screen session already exists
CHECK=`screen -list | grep -o $SERVER`
if [ $SERVER == $CHECK ]
then
screen -XS $SERVER quit
else
#If not already running the screen session is opened and the server is started
screen -XS $SERVER quit
fi
done
terminal: jenachdem, pfad anpassen wo stop script abgelegt wurde
bash /opt/minecraft/ServerStopBedrock.sh
