Execute script from remote

  • Hello,

    I want to assign two keys in my remote to execute two scripts. One is for power on and the other is for power off:

    Code
    # cat on.sh 
    #!/bin/bash
    
    echo "on 0" | cec-client -s -d 1
    systemctl restart kodi
    Code
    # cat off.sh 
    #!/bin/bash
    
    kodi-send --action="PlayerControl(Stop)"   
    systemctl stop kodi
    echo "standby 0" | cec-client -s -d 1

    I map thoose scripts in the remote.xml

    Code
    # cat .kodi/userdata/keymaps/remote.xml | grep "on.sh\|off.sh"
          <start>System.Exec("/storage/on.sh")</start>
          <power>System.Exec("/storage/off.sh")</power>

    The only one that work for me is the power off, I suspect that it is beacuse in the power on, the kodi application is not running.

    Is it possible to execute a script when kodi process is stoped?

    I will appreciate you comments.

    Kind regards.