minecraft-server/mc-server.service.template
2021-12-26 22:49:30 -05:00

20 lines
482 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"
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