On Ubuntu 10.04, I need to start my service with upstart, but only when mysql is up and running.
The problem is that mysql itself is not handled by upstart, so I can't use the "start on" feature.
What can I do ?
|
|
|
You have a few options: 1) make mysql inform Upstart that it has started by emitting an event
This could be handled by adding the 2) Disable mysql from the normal SysV runlevels and create a wrapper Upstart job that starts it (not this doesn't handle stopping - just an example):
Then, have your job " The problem here is that you'll run into trouble if someone (or some system tool automatically) re-adds the 3) Create an upstart job ("waiter") that does "start on stopped rc" (ie start when all the SysV jobs have claimed to have finished) and then polls waiting for mysql to become ready, then exits. Have your job "start on stopped waiter". 4) Convert mysql to an Upstart job (the best option). There's a starting point for an upstart mysql configuration up here: https://github.com/devo-ps/init-scripts/tree/master/mysql/ubuntu |
|||||||||||||||||
|
|
I suggest starting your upstart job after all non-upstart jobs are finished:
|
|||
|
|
|
How about using
inside your upstart job ! |
|||||||||||||||||
|