Need advice on how to execute a custom shutdown script
#1
I am currently using CoreELEC in a dual boot with Android. I want to map a keyboard key to run a custom shutdown script which reboots the system from Android.
Now I know the commands that do that (Rebootfromnand && Reboot) but I am not sure how to bind it to a keyboard press (such as A FUNCTION KEY) 

I am using my system with a FLIRC device, so its easy for me to map a key to one of the function keys, I just dont know how to tell the box to execute that shutdown script once it receives the key press.

Can anybody help me with this? 

Thanks in advance!
Reply
#2
You need to create a keymap (wiki) with something like this in it.

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keymap>
    <global>
        <keyboard>
            <f11>RunScript(full/path/to/script/with/name.py)</f11>
        </keyboard>
    </global>
</keymap>

You will have to write a small python script to import os and call those shell commands as I don't think Kodi can natively call the shell.
Learning Linux the hard way !!
Reply
#3
(2020-07-14, 14:17)black_eagle Wrote: You need to create a keymap (wiki) with something like this in it.

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keymap>
    <global>
        <keyboard>
            <f11>RunScript(full/path/to/script/with/name.py)</f11>
        </keyboard>
    </global>
</keymap>

You will have to write a small python script to import os and call those shell commands as I don't think Kodi can natively call the shell.

Cheers..

I got it to work. Thanks for your help!!
Reply

Logout Mark Read Team Forum Stats Members Help
Need advice on how to execute a custom shutdown script0