[Guide] Making a button to restart XBMC
#1
Sometime XBMC freezes or otherwise gets stuck, not often but sometimes. Its usually my fault when it does but either way I waned to make an easy way to restart it without having to use the computer. To do this I used irexec in the lirc-x package.

This is also really useful if you have update library on restart turned on. Now simply pressing a button will rescan your library.

Most of this info is already available elsewhere in the forum but I have found that some of the methods had depreciated, didn't work for me or weren't exactly what I was looking for. This is my adapted version that works beautifully for me.

After spending many hours on this, XBMC being wiped and starting again at least 3 times without ever remembering what I did last time I think it's finally time to share how I did this so it is written and I never forget.

First we update the sources and download the package which allows running of scripts from a remote button (lirc-x).
Code:
sudo apt-get update
sudo apt-get install lirc-x


Next we ensure that this programme (irexec) runs as a daemon (in the background) as soon as we login to gnome by adding it to the .bash_login script


Code:
nano .bash_login


add the following code and save

Code:
irexec -d

next we make a file contaning the settings for which button and what to with it. I like to use the red button from the MSE remote to do this if you would like to use any other button just change 'red' below to the name of the button you want to choose (for non MSE remotes I have never used the so not sure if this will work, please research elsewhere)

Code:
nano .lircrc

add the following code and save

Code:
begin
prog = irexec
button = Red
config = ~/restartXBMC.sh
end

We have now said every time the red button is pressed to run the script restartXBMC.sh. Now we have to make this script.

Code:
nano restartXBMC.sh

add the following code and save
Code:
#!/bin/bash

ps aux|grep -i justcop |grep -v grep|grep -i xbmc.bin|awk '{print $2}'|xargs kill -9

sleep 2

xinit /usr/bin/xbmc
exit
The first line kills XBMC and then waits 2 seconds. The last line starts it back up again

Next we must make the script executable

Code:
chmod +x ~/restartXBMC.sh

All done!
Reply

Logout Mark Read Team Forum Stats Members Help
[Guide] Making a button to restart XBMC0