mfizz
10 August 2019 10:23
1
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/vpn.sh)</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.
mfizz
11 August 2019 17:47
3
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.
vpeter
10 February 2020 07:31
6
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("/storage/.kodi/scripts/vpn.sh")</favourite>
Or
<favourite name="Start VPN">System.Exec(/storage/.kodi/scripts/vpn.sh)</favourite>
Content of .sh file
#!/bin/bash
openvpn --config /storage/ovpn_configs/001.ovpn --auth-user-pass /storage/ovpn_configs/pass.txt
vpeter
18 August 2022 19:16
10
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
vpeter
19 August 2022 16:50
12
Call command directly from pyhon?
import subprocess
subprocess.run('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
Edit;
I have try this modify script and its working