[mythtv] [Feature request] Startup delay

aaron aiperl at rogers.com
Mon Dec 6 23:52:06 UTC 2004


On Mon, 06 Dec 2004 12:20:42 +0000 spake Ed of:

> What about using some scripting magic to check if mysql is alive yet?  
> I'm sure it creates a creates a lock file somewhere, or perhaps you can 
> try to connect a few times, etc.  Try a quick search through google, 
> checking the db is alive before doing something can't be an uncommon 
> problem so I'm sure you can get some new and interesting ways to solve this.

I use "mysqladmin ping" which seems to be the right tool for the job...

while true; do
  /usr/bin/mysqladmin ping > /dev/null 2>&1 && break
  sleep 1
done

and then once mysql is confirmed to be up, it runs a few housekeeping
commands, like ensuring the database is consistent (mysqlcheck), starts up a
mythcommflag in the background to finish up any interrupted flagging jobs, and
then starts the backend. It's been working well for me for about six months or
so.

I'm using daemontools, which is a bit ugly and the documentation is crap, but
once you figure it out it works pretty well.

A self-maintaining system has been my goal from the start, and I like to think
that I'm reasonably close to achieving that goal, though there are still a few
manual jobs I have to do occasionally.

aaron


More information about the mythtv-dev mailing list