How to make mythfrontend start automatically with X

Now that I’ve covered starting mythbackend on boot, I’m going to explain how to get mythfrontend running as soon as you start X.

Its pretty simple, as its just a few lines in your .xinitrc

I’m using fluxbox, so thats the example I’ll be using.

I’m also assuming that you have your X working properly, and have tested it properly.

Hopefully, you’re planning on running your mythfrontend as a seperate user (ie: not root).

I’m using ‘mythtv’
If you don’t have your own mythtv user, create one

adduser mythtv

Then edit the .xinitrc file in home directory of the user you intend on running as.
I’ll assume that we’re using ‘mythtv’ as your user from here… if yours is different, make sure to change your paths to reflect this.

Open your .xinitrc in your favourite text editor


Put the following lines in it:

exec xset -dpms s off &
exec /usr/bin/fluxbox & wmpid=$!
exec mythfrontend 2>> /home/mythtv/mythfrontend.errors &
wait $wmpid

What this does, is uses xset to turn off the screen saver (makes sense…)
It then starts up fluxbox, and stores the PID in the variable $wmpid
Then it starts up mythfrontend, and outputs the errors to /home/mythtv/mythfrontend.errors
Then it waits on the PID of fluxbox, so X doesn’t exit until fluxbox exits

Now go ahead and start up X


With any luck, it’ll go straight into mythfrontend