minecraft-server/mc-server.service.template

22 lines
640 B
Plaintext
Raw Permalink Normal View History

2021-12-27 03:49:30 +00:00
[Unit]
2021-12-27 04:09:40 +00:00
Description=[SERVER_NAME]
2021-12-27 03:49:30 +00:00
After=local-fs.target network.target
[Service]
2021-12-27 04:09:40 +00:00
WorkingDirectory=[SERVER_DIRECTORY]
User=[USERNAME]
Group=[USERNAME]
2021-12-27 03:49:30 +00:00
Type=forking
2021-12-27 04:09:40 +00:00
Environment="SERVERNAME=[SHORT_SERVER_NAME]"
2021-12-27 03:49:30 +00:00
# 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:
2021-12-27 03:49:30 +00:00
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