fix rcon and intruduce systemd integration

This commit is contained in:
anonoe 2025-12-16 00:36:16 +01:00
parent a0d0c47b53
commit 0289aab9b0
4 changed files with 44 additions and 6 deletions

25
server/MMS.container Normal file
View file

@ -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

View file

@ -1,6 +1,5 @@
[MMS] [MMS]
hostname = 0.0.0.0 hostname = 0.0.0.0
port = 25565 port = 25575
#password is redacted password = PUT_PASSWORD_HERE_FROM_server.properties
password =
minecraft = true minecraft = true

View file

@ -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

View file

@ -46,9 +46,9 @@ server-port=25565
enable-jmx-monitoring=false enable-jmx-monitoring=false
enable-query=false enable-query=false
query.port=25565 query.port=25565
enable-rcon=false enable-rcon=true
rcon.port=25575 rcon.port=25575
#password is redacted # PUT A PASSWORD HERE
rcon.password= rcon.password=
use-native-transport=true use-native-transport=true
network-compression-threshold=256 network-compression-threshold=256