@sam_nazarko Most of that went over my head.
Something you said about reboot made me check, first time I launch after reboot kodi shut down take longer then 10 secs, ending with a black screen. But if i restart mediacenter again, sshing in and running sudo systemctl start mediacenter. Kodi comes back up, and the fun part is, if I launch x11 again it just takes 12 seconds.
Now i guess you figured as much, but for me it is “magic”
Edit: In short is there a way to trigger an “exit” from bash right now, or is that something you have to add to the code?