Created
January 15, 2024 22:35
-
-
Save Deliquescence/fd0b374dcb8461a8261d19d0641043b7 to your computer and use it in GitHub Desktop.
Minecraft server systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd "/home/minecraft/Minecraft/Server" | |
source "/home/minecraft/Minecraft/Server/run.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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