minecraft-server/mc-server.service.template

22 lines
640 B
Plaintext

[Unit]
Description=[SERVER_NAME]
After=local-fs.target network.target
[Service]
WorkingDirectory=[SERVER_DIRECTORY]
User=[USERNAME]
Group=[USERNAME]
Type=forking
Environment="SERVERNAME=[SHORT_SERVER_NAME]"
# Do not edit anything beyond this point unless you know what you are doing.
# Please ensure that you have 'screen' installed for the following to work:
ExecStart=/usr/bin/screen -dmS $SERVERNAME -t console ./start.sh
ExecStop=/usr/bin/screen -p console -S $SERVERNAME -X eval 'stuff \015' 'stuff \"stop\"\015'
ExecStop=/bin/bash -c "while ps -p $MAINPID > /dev/null; do /bin/sleep 1; done"
[Install]
WantedBy=multi-user.target