[mythtv-users] How to wait for mysqld to be ready before launching the backend?

Mark Wormgoor mark at wormgoor.com
Wed Jun 17 06:37:55 UTC 2009


Hi,

> I have some issues with my setup: it is a combined BE/FE, and 1 out of 
> 3 times mysql is read for connections much later than usual because it 
> is busy recovering from a crash (this may be related to some issues 
> with the intel driver crashing during the shutdown of my PC, but this 
> is another story).
> To make a long story short, I want to modify the backend startup script 
> to make sure mysqld is ready for connection before launching the BE. 
> Indeed for now the BE exits if it cant connect to the DB.

Here's what I've used, which is an ugly hack, but works like a charm :). 
Add the following to /etc/rc.d/rc.local:
/usr/bin/at "now + 5 minutes" <<EOF
/etc/init.d/mythbackend restart
EOF

It isn't real-time, but will ensure your mythbackend is absolutely the 
last thing to get started. You may loose 5 minutes on your recording, 
but my machine rarely restarts (power loss + kernel upgrades only), 
maybe once a month, probably less.

Kind regards,

Mark


More information about the mythtv-users mailing list