Cannot get script to run from favourites.xml

I am trying to run a shell script via the favourites menu in kodi.

I have done it before, I have a shell script that I want to run to do some command. I am trying to put this into the favourites.xml as:

    <favourite name="Toggle VPN">RunScript(/storage/.kodi/scripts/</favourite>	

I have even tried System.Exec. In both instances in debug log i see something completely unrelated with aml8 audio etc, but it never runs the script.

Don’t run shell scripts: use python. Then it will be executed.

alright, shell scripts are problematic i see

You can run a python script from favourites that starts a shell script.

Why is it necessary to run Python? Is it a limitation of CoreELEC? Kodi’s documentation describes System.Exec() like this:

Execute shell commands. The full path to the script has to be placed inside the parentheses.

This implies that any shell script should work.

Yes, System.Exec also works.

Hi, i can’t get System.Exec in favorites to run my .sh script that runs openvpn client session. Running .sh from terminal works, so script itself dont have problems

Use full path to your files or before your commands put

. /etc/profile

On my favorites i have

<favourite name="Start VPN">System.Exec(&quot;/storage/.kodi/scripts/;)</favourite>


<favourite name="Start VPN">System.Exec(/storage/.kodi/scripts/</favourite>

Content of .sh file

openvpn --config /storage/ovpn_configs/001.ovpn --auth-user-pass /storage/ovpn_configs/pass.txt

Try with full path for openvpn inside shell script.

I manage to get it working by using RunScript insted of System.Exec to call python script that execute bash script. Disadvantage of that approach is that i need to have 2 files .py and .sh

Call command directly from pyhon?

import subprocess'openvpn --config /storage/ovpn_configs/001.ovpn --auth-user-pass /storage/ovpn_configs/pass.txt', shell=True)
1 Like

Will try, im not programmer just regural user with little bit of extra knowledge. So thanks for help

I have try this modify script and its working