[mythtv-users] Starting mythfrontend with systemd?

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Oct 6 02:37:14 UTC 2017

On Wed, 4 Oct 2017 17:53:06 -0400, you wrote:

>Sorry for all the recent posts, but after running MythTV since 2011, the
>upgrade to 29/16.04 has tossed a few curveballs at me. Most things have
>been smooth but there's a few small issues, perhaps due to the fact that
>the previous Mythbuntu ISO install handled so many tasks for you.
>In order to start the mythfrontend on my combined FE/BE at boot I added the
>mythfrontend command to Sessions and Starup. But it's hit and miss as to
>whether it starts up before the backend/mysql are fully up. If it starts
>before then, even the subsequent retries seem to be failing the dbawake
>test, even though mythbackend is running and connected to mysql.
>Looking at
>https://www.mythtv.org/wiki/Configuring_Frontend#Starting_the_Frontend, I
>don't see any mention of scripting the startup.
>Should the Frontend be started with systemd instead and if so is there a
>recommended service file that waits for the backend and mysql to be fully
>functioning before starting mythfrontend?

Mythfrontend is normally started in Mythbuntu by the X session
startup.  In 16.04 with XFCE4, that is found in:

Applications > Settings > Session and Startup > Application Autostart

There should have an entry in that list for "MythTV Frontend". Editing
mine shows that it runs "mythfrontend --service".  Since X starts
pretty late, MySQL or MariaDB should be up and running well before
that.  If they are not, then that is the problem to debug I think, not
trying to make mythfrontend start from systemd instead of X.

If you really need to know if the database is running, then you can
use a script that logs into mythconverg and does a query.  If that
fails, then the database is not up and the script should wait say one
second and try again.  I believe the systemd way of having a service
wait for a script is to run that script as a service itself, and then
run the mythfrontend service only after the script service starts

More information about the mythtv-users mailing list