Skip to content

Instantly share code, notes, and snippets.

@pnxl
Created April 17, 2022 08:46
Show Gist options
  • Save pnxl/8e0709f20378251de0496f74435258d2 to your computer and use it in GitHub Desktop.
Save pnxl/8e0709f20378251de0496f74435258d2 to your computer and use it in GitHub Desktop.
minecraft server as a service unit
[Unit]
Description=Minecraft server running under [ADDRESS].
[Service]
WorkingDirectory=[PATH TO SERVER DIR]
ExecStart=/usr/bin/java -jar -Xmx3G [PATH TO SERVER JAR]
ExecStop=/bin/kill -s SIGINT -$MAINPID & /bin/kill -s SIGINT -$MAINPID
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=minecraft
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment