I have a set of upstart tasks which share an embedded database. When I start one of these tasks, and another is already running, I want the task to get queued up, and run when the other task is finished.
The cookbook has an example in section 11.6 synchronization. It doesn't work, and now I've read it, I can't see any way it could work. Specifically the pre-start script reads
pre-start script start synchronized || true end script
and will allow the example jobs to continue, whether the synchronized service was running or not, and hence there's no mutual exclusion under any circumstances.
I guess I could do this:
pre-start script until start synchronized do sleep 1; done end script
but it seems less than elegant. Has anyone else achieved something similar another way?