Skip to content

Instantly share code, notes, and snippets.

@Pobega
Created May 28, 2019 03:00
Show Gist options
  • Save Pobega/a13a71bd0b02b9dcfd32da669adbc772 to your computer and use it in GitHub Desktop.
Save Pobega/a13a71bd0b02b9dcfd32da669adbc772 to your computer and use it in GitHub Desktop.
/etc/systemd/system/minecraft.service:
[Unit]
Description=Start Minecraft
After=network.target
[Service]
WorkingDirectory=/opt/minecraft/
Type=simple
User=mc
Group=mc
ExecStart=/usr/bin/screen -DmS mc ./start.sh
ExecStop=/usr/bin/screen -p 0 -S mc -X eval 'stuff "save-all"\015'
ExecStop=/usr/bin/screen -p 0 -S mc -X eval 'stuff "stop"\015'
Restart=on-failure
RestartSec=60s
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment