Execute shell command from addon
#1
If I SSH into Libreelec on my rPi I can run
Code:
systemctl stop service.downloadmanager.transmission.service

How can I replicate this action using my addon?
Reply
#2
http://kodi.wiki/view/list_of_built-in_functions

System.Exec

There are a few other ways as well.
Reply
#3
I tried:

Code:
import xbmc
xbmc.executebuiltin('System.Exec(systemctl stop service.downloadmanager.transmission.service)')

but nothing happens. Actually it seems to crash;

Quote:12:31:39 620.833069 T:1962889216 ERROR: ActiveAE::Resume - failed to init
12:31:39 620.833679 T:1962889216 FATAL: OnApplicationMessage: Failed to restart AudioEngine after return from external player
Reply
#4
some other options are:
- os.system()
- subprocess.call()
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
Just out of curiosity, when kodi executes a shell script does it use the same user ID as one would use to ssh or does it have it's own specific userid?
Reply
#6
Code:
import os
os.system("stop service.downloadmanager.transmission.service")

Code:
import subprocess
subprocess.call('stop service.downloadmanager.transmission.service', shell=True)

These don't seem to be doing anything either...although I'm not getting a crash this time.
Reply
#7
that's a different command then in your first post ;-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#8
Doh, sometimes I do not know why I make these stupid mistakes, it's working now, thanks ronie!
Reply

Logout Mark Read Team Forum Stats Members Help
Execute shell command from addon0