Guide to Executing Commands from a Remote

This guide will show you how to execute commands from your remote using irexec. This example will show you how to restart xbmc.

Firstly login to your OpenELEC machine via SSH and install the nano text editor

Create a irexec config:
nano /storage/.config/.lircrc

Paste in:

begin button = KEY_BRL_DOT1 prog = irexec config = /bin/killall -9 xbmc.bin & end

Crtl + x to exit. Use the command irw to see what button is being pressed on your remote and replace the button field.

Create a udev rule to start irexec:
nano /storage/.config/udev.rules.d/irexec.rules

ACTION=="add", SUBSYSTEM=="rc", RUN+="/usr/bin/irexec -d /storage/.config/.lircrc"

OPTIONAL: Restarting irexec on suspend and resume
I find irexec crashes sometimes so I restart it on suspend. Resume/suspend hooks to restart irexec:

nano /storage/.xbmc/addons/_pm-suspend/sleep.d/irexec.power

[ "$1" = "resume" ] && sleep 2 && /usr/bin/irexec -d /storage/.config/.lircrc

nano /storage/.xbmc/addons/_pm-suspend/sleep.d/kill-irexec.power

[ "$1" = "suspend" ] && killall -q irexec

You may need to create some of the directories using mkdir.

Reboot and that should do it.