From 539008f15c2b6a1eaa5a063645a6c7a3b6318d64 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 19 Apr 2021 09:24:40 +0200 Subject: [PATCH] daily autocommit --- .etckeeper | 1 + motd | 6 ++-- systemd/system/minecraft@.service | 53 +++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 systemd/system/minecraft@.service diff --git a/.etckeeper b/.etckeeper index 5e3eaaa..3f7709a 100755 --- a/.etckeeper +++ b/.etckeeper @@ -1318,6 +1318,7 @@ maybe chmod 0755 'systemd/system/getty.target.wants' maybe chmod 0755 'systemd/system/mariadb.service.d' maybe chmod 0644 'systemd/system/mariadb.service.d/override.conf' maybe chmod 0644 'systemd/system/minecraft.service' +maybe chmod 0644 'systemd/system/minecraft@.service' maybe chmod 0755 'systemd/system/multi-user.target.wants' maybe chmod 0755 'systemd/system/netdata.service.d' maybe chmod 0644 'systemd/system/netdata.service.d/limits.conf' diff --git a/motd b/motd index c971edd..9c25792 100644 --- a/motd +++ b/motd @@ -6,9 +6,9 @@ Debian GNU/Linux 10 (buster) |_| |_|\___|_|\__, |\__,_| |___/ -Löste sich doch in jeder italienischen Schule der Schmetterling -aus der Puppe los! - -- Goethe, Maximen und Reflektionen, Nr. 1153 +Der Mensch ist bereit, für jede Idee zu sterben, vorausgesetzt, daß +ihm die Idee nicht ganz klar ist. + -- Gilbert Keith Chesterton Today is Prickle-Prickle, the 36th day of Discord in the YOLD 3187 diff --git a/systemd/system/minecraft@.service b/systemd/system/minecraft@.service new file mode 100644 index 0000000..e1903b8 --- /dev/null +++ b/systemd/system/minecraft@.service @@ -0,0 +1,53 @@ +[Unit] +Description=Minecraft Server: %i + +Wants=network.target +After=network.target + +[Service] +WorkingDirectory=/home/minecraft/%i + +# Users Database is not available for within the unit, only root and minecraft is available, everybody else is nobody +PrivateUsers=true + +User=minecraft +Group=users + +# Read only mapping of /usr /boot and /etc +ProtectSystem=full + +# /home, /root and /run/user seem to be empty from within the unit. It is recommended to enable this setting for all long-running services (in particular network-facing ones). +ProtectHome=true + +# /proc/sys, /sys, /proc/sysrq-trigger, /proc/latency_stats, /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq will be read-only within the unit. +# It is recommended to turn this on for most services. +# Implies MountFlags=slave +ProtectKernelTunables=true + +# Block module system calls, also /usr/lib/modules. It is recommended to turn this on for most services that do not need special file systems or extra kernel modules to work +# Implies NoNewPrivileges=yes +ProtectKernelModules=true + +# It is hence recommended to turn this on for most services. +# Implies MountAPIVFS=yes +ProtectControlGroups=true + +#ExecStart=/usr/bin/screen -DmS mc-%i /usr/bin/java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui + +ExecStart=/bin/sh -c '/usr/bin/screen -DmS mc-%i /usr/bin/java -server -Xms1024M -Xmx1024M -XX:+UseG1GC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar minecraft_server.jar nogui' + +ExecReload=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "reload"\\015' + +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECONDS. SAVING ALL MAPS..."\015' +ExecStop=/bin/sleep 5 +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"\015' +ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"\015' +ExecStop=/bin/sleep 10 + +Restart=on-failure +RestartSec=60s + + +[Install] +WantedBy=multi-user.target + -- 2.39.5