Kodi Community Forum

Full Version: Kodi restart command line
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, 
I run kodi 17 on raspberry pi raspbian os.
How can i start/stop/restart kodi from command line?
thanks
just figured out, sorry 
sudo kodi start
Why would you need to be root to start kodi ??
so i am just testing.
I have kodi installed on raspbian and use it without screen to play internet radio.  So far i control it via ios app Sybu. However i am trying, without success to make an autoexec.py to start kodi with a specitic internet stream.  And while playing with the syntax i needed to restart  to see if it works.  Thats why.  Actually what does not work is an autoexec.py
this is the script
import xbmc
xbmc.executebuiltin("Playmedia(http://s3.sonicabroadcast.com:8805)")
@mina5000

One more time of URL spamming and you will be kicked of this forum instantly.
This is your first and final warning.
(2019-01-20, 17:07)VisiAndy Wrote: [ -> ]just figured out, sorry 
sudo kodi start

Hi VisiAndy,
thank you for that command! Actually, following code lines work fine for me and my Raspberry (running Raspbian Buster).
 
Code:
sudo kodi start
sudo kodi stop

My only problem is that the command's action do not finish, means I do not get back to a new terminal command line.
I would like to start and stop Kodi with a Python script but the script gets stuck with the mentioned start command (same as in terminal).
I hope my question is not too “off topic”: Does somebody know how to avoid this behaviour or how to finish the start and stop action?

Thank you!
I use:

systemctl start kodi.service
systemctl stop kodi.service

on my install and command line comes back when its run.
(2021-08-22, 22:31)jeffski10 Wrote: [ -> ]I use:

systemctl start kodi.service
systemctl stop kodi.service

on my install and command line comes back when its run.

Thank you for the fast reply jeffski10!

I was able to get
Code:
systemctl status kodi
to run with the behaviour you mentioned, using some help from https://gist.github.com/Cyberek/33af1b92...ccf87b8a3a
 
Code:
systemctl status kodi
echos the following status:
 
Code:
● kodi.service - LSB: XBMC media centre
   Loaded: loaded (/etc/init.d/kodi; generated)
   Active: inactive (dead) since Mon 2021-08-23 00:06:44 BST; 1min 33s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 411 ExecStart=/etc/init.d/kodi start (code=exited, status=0/SUCCESS)
  Process: 1126 ExecStop=/etc/init.d/kodi stop (code=exited, status=0/SUCCESS)
    Tasks: 34 (limit: 2059)
   CGroup: /system.slice/kodi.service
           ├─553 /bin/sh /usr/bin/kodi --standalone
           └─584 /usr/lib/arm-linux-gnueabihf/kodi/kodi.bin_v7 --lircdev /var/ru

Do you have an idea what I have to do to get the stop command running? I am using Arctic: Zephyr 2 and it does not react to the command (at least command comes back in seconds... ​)
(2021-08-23, 01:21)Larry Add Wrote: [ -> ]Do you have an idea what I have to do to get the stop command running?

Mmm. Not sure as for me the stop command above works fine and stops the app but admittedly this is not on a pi. As you are on a pi and sounds like a native install rather than Libreelec assume you are using sudo as well ?
(2021-08-23, 10:42)jeffski10 Wrote: [ -> ]
(2021-08-23, 01:21)Larry Add Wrote: [ -> ]Do you have an idea what I have to do to get the stop command running?

Mmm. Not sure as for me the stop command above works fine and stops the app but admittedly this is not on a pi. As you are on a pi and sounds like a native install rather than Libreelec assume you are using sudo as well ?
Correct I am using sudo to command... same effect.
@Larry Add You need to be more explicit about what you want to do, what you are doing, what's your environment (OS, etc).

sudo systemctl stop kodi will work only if you start Kodi as a service with sudo systemctl start kodi
if you start Kodi with a desktop icon or DE menu systemctl command won't work.

There are many ways to skin the cat here, but it is absolutely unclear to me what you are trying to achieve.