Kodi Community Forum
v20 User script does not execute with System.Exec - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: v20 User script does not execute with System.Exec (/showthread.php?tid=372976)



User script does not execute with System.Exec - adama42 - 2023-04-29

Hi

I'm trying to execute a script when pressing a button on the remote.
Kodi detects the keypress but doesn't execute the script Sad

My script:
 
Code:
#!/bin/sh

/usr/bin/date >> /storage/.kodi/temp/test.txt
echo "TEST" >> /storage/.kodi/temp/test.txt

My keymap.
 
Code:
<keymap>
  <loginscreen><keyboard>
    <!-- leftmost red bar key -->
    <key id="251">System.Exec(/storage/bin/test.sh)</key>
    <!-- green bar key (next to red one) -->
    <key id="252">System.Exec(/storage/bin/test.sh)</key>
  </keyboard></loginscreen>
  <global><keyboard>
    <key id="50">contextmenu</key>
  </keyboard></global>
  <fullscreenvideo><keyboard>
    <key id="44">cyclesubtitle</key>
  </keyboard></fullscreenvideo>
  <filemanager><keyboard>
    <key id="50">contextmenu</key>
  </keyboard></filemanager>
</keymap>


Kodi log showing I pressed the button 3 times:
https://paste.kodi.tv/ayijitepev.kodi

the intesting part is
 
Code:
2023-04-29 19:22:45.457 T:27288 debug <general>: PushCecKeypress - received key fb duration 0
2023-04-29 19:22:45.465 T:27263 debug <general>: HandleKey: 251 (0xfb, obc4) pressed, window 10029, action is System.Exec('/bin/sh /storage/bin/test.sh')
2023-04-29 19:22:45.797 T:27288 debug <general>: PushCecKeypress - received key fb duration 340

If I execute the script from the shell with `/bin/sh /storage/bin/test.sh` it works fine.

How do I fix this?

Thanks


RE: User script does not execute with System.Exec - adama42 - 2023-06-23

Can anyone please help with this?

Thanks


RE: User script does not execute with System.Exec - izprtxqkft - 2023-06-23

works fine for me mapped to F8, debian linux desktop, kodi 20.0 20230116-ec5b71680e (from january)

<F8>System.Exec(/path/to/script.sh)</F8>

make sure the script is executable - chmod +x /storage/bin/test.sh

and the target path /storage/.kodi/temp/test.txt is writeable