minecraft-server/mc-server.service.template

20 lines
482 B
Plaintext
Raw Normal View History

2021-12-27 03:49:30 +00:00
[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"
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