diff --git a/server/MMS.container b/server/MMS.container new file mode 100644 index 0000000..61d955c --- /dev/null +++ b/server/MMS.container @@ -0,0 +1,25 @@ +[Unit] +Description=Modded Minecraft Server via Podman managed by Systemd +Documentation=https://git.nanody.de/anonoe/MMS + +[Container] +Image=git.nanody.de/anonoe/jre-alpine:latest +AutoUpdate=registry +PublishPort=25565:25565/tcp +PublishPort=24454:24454/udp +UserNS=keep-id +Mount=type=bind,src=/PATH/TO/server,dst=/mnt/server +Mount=type=bind,src=/PATH/TO/rcon,dst=/mnt/rcon +WorkingDir=/mnt/server +PodmanArgs=--tty --interactive +Exec=java -Xmx4G -Xms1G -jar minecraft_server.jar --nogui + +[Service] +SuccessExitStatus=0 143 +TimeoutStartSec=480 +TimeoutStopSec=480 +ExecStop=-podman exec systemd-MMS sh /mnt/rcon/stop.sh + +[Install] +# Start by default on boot +WantedBy=default.target diff --git a/server/rcon/rconrc b/server/rcon/rconrc index 91c3300..e24446e 100755 --- a/server/rcon/rconrc +++ b/server/rcon/rconrc @@ -1,6 +1,5 @@ [MMS] hostname = 0.0.0.0 -port = 25565 -#password is redacted -password = +port = 25575 +password = PUT_PASSWORD_HERE_FROM_server.properties minecraft = true diff --git a/server/rcon/stop.sh b/server/rcon/stop.sh index 1ce7650..66b20bc 100755 --- a/server/rcon/stop.sh +++ b/server/rcon/stop.sh @@ -1 +1,15 @@ -rcon -c /mnt/rcon/rconrc -s MMS stop +alias rc='rcon -c /mnt/rcon/rconrc -s MMS ' +rc 'tellraw @a ["",{"text":"!WARNING!","bold":true,"color":"red"}," The server will ",{"text":"shut down or restart","hoverEvent":{"action":"show_text","contents":"The state is unknown (like quantum physics)"}}," in",{"text":" 10","color":"dark_red"}," seconds..."]' +sleep 5 +rc 'tellraw @a ["Stopping in"]' +rc 'tellraw @a {"text":"5","color":"red"}' +sleep 1 +rc 'tellraw @a {"text":"4","color":"red"}' +sleep 1 +rc 'tellraw @a {"text":"3","color":"red"}' +sleep 1 +rc 'tellraw @a {"text":"2","color":"dark_red"}' +sleep 1 +rc 'tellraw @a ["",{"text":"!","obfuscated":true,"color":"dark_red"},{"text":" 1 ","color":"dark_red"},{"text":"!","obfuscated":true,"color":"dark_red"}]' +sleep 1 +rc stop diff --git a/server/server/server.properties b/server/server/server.properties index 07d7b09..defd953 100644 --- a/server/server/server.properties +++ b/server/server/server.properties @@ -46,9 +46,9 @@ server-port=25565 enable-jmx-monitoring=false enable-query=false query.port=25565 -enable-rcon=false +enable-rcon=true rcon.port=25575 -#password is redacted +# PUT A PASSWORD HERE rcon.password= use-native-transport=true network-compression-threshold=256