Restart MythTV frontend via Remote
This one should help out any non-technical MythTV user. The most common issue I run into is when my wife goes to control the frontend and it has lost sync with the backend (most of the time because I was working on something and forgot to check on things when I was done). Simply restarting the frontend fixes these issues, but she doesn't know how to ssh in and handle this task, so lets make a button (or series if you want to be safe) on the remote do it for her.
Create a file in /usr/local/bin, call it whatever you want, I called mine restart-myth. Include the following in that file:
# /bin/bash
killall mythfrontend.real
DISPLAY=:0 /usr/bin/mythfrontend --service &
Then
sudo chmod +x <file from above>
Now in your ~/.lirc/mythtv file, we are going to add a button to handle our restarts. Start by copying one of the other button blocks, and modifying it to fit your needs. Here are my end results:
begin
remote = AntecFusionMCE.conf
prog = irexec
button = power
button = CLEAR
repeat = 0
config = restart-myth
end
Of importance here, I used 2 buttons because I want to avoid mistakes, so the user will need to hit power followed by clear. Most of your other blocks will say mythtv in the prog, we need irexec here to execute the script we made earlier. Lastly the script you created earlier is referenced in the config.
When everything is done you need to restart a few things, save anything you have opened and don't want to lose. For 9.10 run the following:
sudo /etc/init.d/lirc restart
sudo service gdm restart
Anything before 9.10 run this instead:
sudo /etc/init.d/lirc restart
sudo /etc/init.d/gdm restart
Plans are to introduce something close to this functionality into the Mythbuntu-Control-Centre for the Lucid release. Feel free to leave some feedback we are interested in what buttons people like for this option and ways they would want to handle avoiding accidental restarts.

Comments
Don't forget other running procs
I have a similar shortcut, but found that MythTV sometimes drops control to mplayer (MythVideo does this). So I also pkill mplayer, so she can restart the whole thing from any component of MythTV's suite.
Restart GDM seems a little excessive though ... isn't it?
re: Don't forget other running procs
Good point with the other apps, we will have to take that into consideration. IMO there isn't much that internal player can't handle anymore, but I am sure there are some exceptions.
You could just execute your restart script you made earlier instead of restarting GDM, you just need to make sure you kill your current running mythfrontend before it will pick up any .lirc changes.
Nice
It would be nice to have this setup by default by mythbuntu.. maybe with options
Remote Power Button
- does nothing
- restart front end
- restart X
- restart machine
- Power Off machine
irexec should be already running
Hello,
I've setup a variation of this tutorial.
One thing I've noticed is that irexec need to be running somehow.
I've placed it in the startup programs of the session running mythfrontend.
I'm running Mythbuntu 9.10, upgraded throught the years from 7.04.
Nico
re: irexec should be already running
In 9.10 you shouldn't need to add irexec to startup. Not quite sure about the other releases at this point.