custom job to be prioritised against system jobs - Take 2

Clint Byrum clint at ubuntu.com
Wed Mar 7 17:42:44 UTC 2012


Excerpts from Luigi Capriotti's message of Wed Mar 07 05:55:24 -0800 2012:
> Having found examples of wait-jobs I gave it a try but still no success.
> 
> My custom jobs are something like:
> 
> # myjob
> start on (starting lightdm or starting ubiquity)

This bug explains the problem you're having:

https://bugs.launchpad.net/upstart/+bug/568860

Basically, upstart will not block if there is no goal change. So when
'starting ubiquity' is processed, it sees a job that needs a goal change
(stop -> start) and blocks 'starting ubiquity' until that goal change
is "complete", which, since this is a task, means until the task has
*stopped*.

> task
> 
> script
>     # blablabla
> 
> end script
> 

Because of this, you just need two tasks instead of your one. Newer
versions of the upstart package in Ubuntu include 'wait-for-state'
to help work around the mentioned bug. It basically is just a generic
version of the wait job you already implemented:


# myjob-delay-lightdm
start on starting lightdm
task
exec start wait-for-state WAIT_FOR=myjob WAITER=myjob-delay-lightdm

# myjob-delay-ubiquity
start on starting ubiquity
task
exec start wait-for-state WAIT_FOR=myjob WAITER=myjob-delay-ubiquity

If you don't have wait-for-state, you can just do two vesions of the
wait job you already did, one for each or condition you need to wait on..



More information about the upstart-devel mailing list