[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