Linux System.Exec does not execute?
#1
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?
Reply
#2
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>
    ...
Reply
#3
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%.
Reply
#4
Fixed it myself.

I use RunScript(...) now.
Reply

Logout Mark Read Team Forum Stats Members Help
System.Exec does not execute?0