Skip to content

Instantly share code, notes, and snippets.

@adamsdesk
Last active February 26, 2016 03:18
Show Gist options
  • Save adamsdesk/f4a38a3506fb69bc0d8f to your computer and use it in GitHub Desktop.
Save adamsdesk/f4a38a3506fb69bc0d8f to your computer and use it in GitHub Desktop.
Minecraft Systemd service unit file. Used to run Minecraft server as a daemon and control it with mcrcon.
[Unit]
Description=Minecraft Server
Wants=network.target
After=network.target
[Service]
User=minecraft
Group=minecraft
Nice=5
SuccessExitStatus=0 1 143 255
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
NoNewPrivileges=true
PrivateTmp=true
InaccessibleDirectories=/root /sys /srv /mnt /media /lost+found
ReadWriteDirectories=/opt/minecraft/server
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xmx1024M -Xms1024M -jar spigot.jar --noconsole
ExecStop=/opt/minecraft/mcrcon -H localhost -P port-number-here -p password-here stop
RestartSec=5s
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment