minecraft-server/mc-server.service.template

20 lines
487 B
Plaintext
Raw 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
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