Created
July 1, 2019 06:29
-
-
Save NathanAdhitya/2c823ba485b6edc572a81a1033162c5e to your computer and use it in GitHub Desktop.
Minecraft systemd service
This file contains hidden or 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=local-fs.target network.target | |
[Service] | |
WorkingDirectory=/home/minecraft/ | |
User=minecraft | |
Group=minecraft | |
Type=forking | |
Restart=on-failure | |
ExecStart=/usr/bin/screen -h 1024 -dmS minecraft ./minecraft_server.sh | /bin/echo ${PIPESTATUS[1]} | |
# Send "stop" to the Minecraft server console | |
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015' | |
ExecStop=/bin/bash -c "while ps -p $MAINPID > /dev/null; do /bin/sleep 1; done" | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment