Last active
July 2, 2022 17:36
-
-
Save HorlogeSkynet/05186008419422836b7615835cbb0eb3 to your computer and use it in GitHub Desktop.
systemd unit file for Minecraft server running against OpenJDK 11
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 | |
Wants=network.target | |
After=network.target | |
[Service] | |
User=minecraft | |
Nice=5 | |
Restart=on-failure | |
SuccessExitStatus=0 143 | |
ProtectSystem=full | |
PrivateDevices=true | |
NoNewPrivileges=true | |
PrivateTmp=true | |
InaccessiblePaths=/root /run/user /sys /srv /opt /media -/lost+found | |
ReadWritePaths=/home/minecraft | |
WorkingDirectory=/home/minecraft | |
ExecStart=/usr/bin/java -Xms1024M -Xmx2048M -jar server.jar --nogui | |
# mcrcon (>= v0.7.1) should be manually installed from <https://github.com/Tiiffi/mcrcon>. | |
ExecStop=/usr/local/bin/mcrcon \ | |
-s \ | |
-w 5 \ | |
-H 127.0.0.1 -P 25575 \ | |
-p 'YOUR_VERY_STRONG_RCON_PASSWORD' \ | |
"say Server is about to restart. See you soon !" \ | |
"stop" | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment