Kodi Community Forum

Full Version: System.Exec does not execute?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I added a custom menu entry to Home.xml:
Code:
<item id="8">
    <label>test</label>
    <onclick>System.Exec(/bin/sh sudo sh /home/xbian/test.sh)</onclick>
    <icon>-</icon>
    <thumb>-</thumb>
</item>

The sh does only contain
Code:
sudo reboot

When I click on the menu entry, it seems to be the RPi does something, because the mouse movement is not fluid for a second. But the system does not reboot. The log does not say anything about a failed script. It justs holds some info about 3 devices.

I also tried a python script:
Code:
#!/usr/bin/python
import subprocess
subprocess.call("sudo sh /home/xbian/test.sh", shell=True)

Same result. Could someone help me please?
Too many sudos? How about

Code:
    ...
    <onclick>System.Exec(/home/xbian/test.sh)</onclick>
    ...
instead of..

Code:
    ...
    <onclick>System.Exec(/bin/sh sudo sh /home/xbian/test.sh)</onclick>
    ...
Thank you but I tried that too. Does not work.
I also tried
Code:
<onclick>System.Exec(/bin/sh /home/xbian/test.sh)</onclick>

afaik the /bin/sh is neccessary because System.Exec cannot run scripts directly. But I am not sure for 100%.
Fixed it myself.

I use RunScript(...) now.