Initial framework

This commit is contained in:
mathiascode 2020-04-16 22:08:07 +03:00
parent e4e262ceea
commit a6132fe8ab
85 changed files with 4403 additions and 1 deletions

19
script/alivecheck.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# The following script is a failsafe for killing the Minecraft server if it happens
# to be stuck
set -x
while true; do
sleep 420
# If server doesn't respond to ping, or if the log file is older than
# 3 minutes, kill the server
if [ "$(env printf '\xFE' | nc -w 15 new.kaboom.pw 25565 | wc -m)" -eq 0 ]; then
pkill -9 java
kill -9 $(ps -C ssh -o pid=)
echo $(date) >> ~/kill.log
fi
done

13
script/init.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
# This is the core script used when booting up the server
# It asumes that the "framework" folder is located in the home directory
# Run scripts for starting the Minecraft server and schematic
# checker in the background
while true; do
dtach -n kaboom ~/framework/script/server.sh > /dev/null 2>&1
dtach -n schematics ~/framework/script/schematics.sh > /dev/null 2>&1
sleep 5
done &

9
script/reset.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
# The following script is used when resetting the server
# Currently every 24 h
~/framework/script/stop.sh
rm -rf ~/server/*
cp -Tr ~/server-default/ ~/server/

17
script/schematics.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
# Schematics are saved in a separate git repository.
# Only non-existing files are added to the repository.
set -x
git clone git@github.com:kaboomserver/schematics.git ~/server/plugins/FastAsyncWorldEdit/schematics/
while true; do
cd ~/server/plugins/FastAsyncWorldEdit/schematics/
if [ "$(git add $(git ls-files -o) -v)" ]; then
git -c user.name='kaboom' -c user.email='kaboom.pw' commit -m "Add new schematics"
git push
fi
sleep 1
done

28
script/server.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/sh
# The alive checker and Minecraft server is started at the same time. For performance reasons, the
# OpenJ9 JVM is used instead of Java's default Hotspot JVM.
PATH="$HOME/framework/vendor/java/bin/:$PATH"
dtach -n alivecheck $HOME/framework/script/alivecheck.sh
# Make sure we're in the server folder, located in the home directory
cd ~/server/
# Make certain files and folders read-only
chmod -R 500 plugins/bStats/
chmod -R 500 plugins/PluginMetrics/
chmod -R 500 plugins/ProtocolLib/
chmod 400 bukkit.yml
chmod 400 commands.yml
chmod 400 eula.txt
chmod 400 permissions.yml
chmod 400 server-icon.png
chmod 400 wepif.yml
while true; do
java -Xmx1920M -Xtune:virtualized -Xaggressive -Xcompressedrefs -Xdump:heap+java+snap:none -Xdump:tool:events=throw+systhrow,filter=java/lang/OutOfMemoryError,exec="kill -9 %pid" -Xgc:concurrentScavenge -Xgc:dnssExpectedTimeRatioMaximum=3 -Xgc:scvNoAdaptiveTenure -Xdisableexplicitgc -Xshareclasses -Xshareclasses:noPersistentDiskSpaceCheck -XX:MaxDirectMemorySize=128M -XX:+ClassRelationshipVerifier -XX:+UseContainerSupport -DPaper.IgnoreJavaVersion=true -Dpaper.playerconnection.keepalive=360 -DIReallyKnowWhatIAmDoingISwear -jar server.jar
sleep 1
done

5
script/stop.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
# Shutdown script for Paper/Spigot
pkill -9 java