From 55f303657430d1315802eb5b42541ce4c5e8b5ca Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Wed, 18 Nov 2026 12:49:38 +0400 Subject: [PATCH] services: restart Minecraft after it exits on its own AutoUpdateGeyser restarts the server with /restart. Paper finds no start script, stops and exits 0, and Restart=always should start it again. The module binds the stdin socket to the service, though: the exit stopped the socket, the socket's stop cancelled the restart, and the server stayed down from 2026-11-17 16:01 until started by hand. PartOf keeps the socket across an exit and still stops it with the service. FlushPending already drops the "stop" ExecStop leaves in the FIFO. Assisted-by: Claude:opus-5-5 --- nixos/hosts/asxpio-services/minecraft.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/hosts/asxpio-services/minecraft.nix b/nixos/hosts/asxpio-services/minecraft.nix index fb6b54f..2f0ad29 100644 --- a/nixos/hosts/asxpio-services/minecraft.nix +++ b/nixos/hosts/asxpio-services/minecraft.nix @@ -28,6 +28,16 @@ pkgs.stdenv.cc.cc.lib ]; }; + # AutoUpdateGeyser restarts the server with /restart; Paper finds no + # start script and exits 0, and systemd must start it again. The + # module binds the stdin socket to the service, so the exit stopped + # the socket and the socket's stop cancelled Restart=always. PartOf + # keeps the socket across an exit and still stops it with the service. + systemd.services.minecraft-server.serviceConfig.RestartSec = 10; + systemd.sockets.minecraft-server = { + bindsTo = lib.mkForce [ ]; + partOf = [ "minecraft-server.service" ]; + }; networking.firewall.allowedTCPPorts = [ 25565 ]; asxpio.security.ports = [ "tcp/25565/java"