Skip to content

Instantly share code, notes, and snippets.

@Deliquescence
Created January 15, 2024 22:35
Show Gist options
  • Save Deliquescence/fd0b374dcb8461a8261d19d0641043b7 to your computer and use it in GitHub Desktop.
Save Deliquescence/fd0b374dcb8461a8261d19d0641043b7 to your computer and use it in GitHub Desktop.
Minecraft server systemd
[Unit]
Description=Minecraft Server
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=30
User=minecraft
Group=minecraft
ExecStartPre=/bin/sleep 15
ExecStart=/home/minecraft/Minecraft/start.sh
ExecStop=/home/minecraft/Minecraft/stop.sh
[Install]
WantedBy=multi-user.target
#!/bin/sh
cd "/home/minecraft/Minecraft/Server"
source "/home/minecraft/Minecraft/Server/run.sh"
#!/bin/sh
mcrcon -p password stop
while kill -0 $MAINPID 2>/dev/null
do
sleep 0.5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment