Can not keep Kodi closed. Kodi keeps respawning after stopping Mediacenter service and killing kodi

Hi,

I need to kill Kodi in order have my moonlight session beeing visible.

I followed this guide:
https://osmc.tv/wiki/general/starting-and-stopping-kodi/

And tried to stop and disable Kodi.

Unfortunately Kodi keeps coming back after a few seconds.

Also rebooting didn’t help.

All of the following commands fail to keep Kodi closed permanently:

sudo systemctl stop mediacenter

sudo systemctl disable mediacenter

pkill kodi

Kodi closes but it starts again after maybe 15 seconds or so and then is shown on top of my moonlight session window making it impossible to see my moonlight screen session.

How can i close Kodi either until reboot or permanetly, or alternatively put it inot background of my moonlight session?

I would prefer a solution via script that closes Kodi and starts my moonlight command.

Thanks!

What’s the purpose of the moonlight session? Why does it need to be visible? Do you navigate with a mouse in it?

No i just stream the screen. I control the pc or osmc via iphone only. Or sometimes play games with an xbox one controller that is paired to the windows pc.

So only the pc has keyboard/mose. The raspberry has just a wifi dongle nothing else.

Whereto do you stream it? Wouldn’t it be simpler/better to access the files that you play via Pi with the dive to which you stream?

Disabling it will simply stop it starting at system boot.

Simply as an experiment, run:

systemctl stop mediacenter
sudo systemctl mask mediacenter

That will stop kodi being started through systemd. If it still starts, then it’s happening via a different route.

@RJ45 Moonlight streams what happens on a desktop pc to the Pi. Kodi needs to be disabled otherwise it hijacks the screen.

@Rocket I always stopped and started kodi with sudo service mediacenter stop/start, try and see if it works.

@TheHacker66 Sure! I was asking for the why behind all of this because to me, OP sounded like he was having an XY problem.

Edit: its not working. Non of the commands posted here stop Kodi from starting again.

Yesterday for some reason, the following command worked until a reboot. But now even this command does not keep Kodi closed permanently.

I now help myself with this command:

watch -n 10 pkill kodi


   sudo service mediacenter stop

Does the job!

The guide should be updated.

Thanks!

systemctl stop works fine here.
What version of OSMC are you on?

osmc@osmc:~$ grep VERSION_ID /etc/os-release
VERSION_ID=“2018.08-2”

/usr/sbin/service is a shell-script wrapper that should run systemctl commands. Taken from line 182 of the script:

# When this machine is running systemd, standard service calls are turned into
# systemctl calls.

Debian 9, which OSMC runs, uses systemd.

As Sam said, it should work. It also doesn’t explain why mediacenter was restarting 15 seconds after being stopped.