Kodi Community Forum

Full Version: Run script with IR remote
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'd like to associate for example keyboard button 'r' to run the script that will reboot the system.

So i'm using executor addon which is able to run scripts. If i go into executor plugin i can run the script which restarts the system.
Now i would like to associate the script with keyboard button.

The scrip entry from favourites menu fro shutdown is:
<favourite name="Restart">RunPlugin(&quot;plugin://plugin.program.executor/?do=program&amp;id=Restart&quotWink</favourite>

What would be the right entry in keyboard.xml to call this.
Can you not use XBMC's shutdown/restart/suspend menu instead?

That way you can call the XBMC.restart from the keyboard.xml
I want to use this in case xbmc freezes so i could be able to restart it with remote. Because in many cases the ssh is alive even if xbmc is not responding.
I use lirc with irexec to do what you want to do.
(2012-12-26, 21:46)teeedubb Wrote: [ -> ]I use lirc with irexec to do what you want to do.

+1, it works flawlessly and is very easy to setup. I use it to kill emulators with the remote.
Negge, I'm curious, how do you launch irexec? I had some troubles with it stopping responding after a while and with multiple instances of it causing havoc, but now I launch it via xinit with xbmc and it works fine.
@teeedubb: I've put the following in /etc/rc.local:

etc/rc.local Wrote:/usr/bin/irexec -d /etc/lirc/irexec.conf

irexec.conf looks like this:

irexec.conf Wrote:# IREXEC start XBMC script
#
# Runs the start_xbmc.sh script (as sam) when the power button is pressed
#

begin
prog = irexec
remote = mceusb
button = Power
config = su sam -c /home/sam/start_xbmc.sh
repeat = 0
end

#
# Kills any games if the Record button is pressed
#
begin
prog = irexec
remote = mceusb
button = Record
config = /etc/lirc/kill_emu.sh
repeat = 0
end

kill_emu.sh Wrote:#!/bin/sh

killall retroarch
killall DeathRally.exe
killall mupen64plus
killall dosbox

exit 0
Interesting.. I tried launching it from rc.local as a normal user and it would work randomly and stop responding after resumes... I'm sure I tried it as root too but same problems. Is it stable through suspend/resumes and general use for you Negge?
I never suspend/hibernate so I can't tell. If it's giving you problems you could add a script which kills and restarts it into /etc/pm/sleep.d (Google should have some examples).

Everything you put in /etc/rc.local get run as root by the way.
Hmmmm ill check k my rc. Local tonight to see if I commented out or deleted the command to launch irexec, but I never got far enough to use a resume hook to restart it because it wouldn't start half the time. It's working great now that it's launched through xinit, so I'm hesitant to fix something that ain't broken. Also Negge, it is possible to execute commands from rc.local as a regular user, from memory it was using sudo..

Thanks for the link, I read through them while trying to work my problem originally.. Illiac let us know how you go using the info in the links you posted.

EDIT: The command I had troubles with:

# su -c '/usr/bin/irexec -d /home/xbmc/.lircrc' -l xbmc