Upstart : start service after non-upstart process
You have a few options:
1) make mysql inform Upstart that it has started by emitting an event
initctl emit mysql-started" or similar.
This could be handled by adding the
initctl invocation to
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):
cat >>/etc/init/mysql-sysv.conf<<EOT # wait for SysV job to finish start on stopped rc exec /etc/init.d/mysql start EOT
Then, have your job "
start on started mysql-sysv".
The problem here is that you'll run into trouble if someone (or some system tool automatically) re-adds the
/etc/rc?.d links to the original
/etc/init.d/mysql service script. Also, you may find that mysql isn't actually ready until some time after it's main pid has started. Databases are problematic as they might take some time to come "online" even after they have started (transction log replay, etc).
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