Run upstart job exclusively or before upstart process
James Hunt
james.hunt at ubuntu.com
Thu May 10 22:58:20 UTC 2012
On 10/05/12 17:24, Rogerio Vinhal Nunes wrote:
> I'm already doing the start on starting mountall, but while the job is copying the directory some
> other jobs are processing. I don't know why, but when I do that the system simply stops (possibly
> triggers a deadlock) and after 2 minutes it says that the task modprobe is not responding for 120
> seconds.
>
> I figured that this task might be the module-init-tools, so I did:
>
> start on (starting mountall or starting module-init-tools)
>
> With that the system stops locking, but strangely my job runs twice. Is that expected?
Yes: http://upstart.ubuntu.com/cookbook/#run-a-job-for-all-of-a-number-of-conditions
The way to have your job start before *any* other is to use 'and' and specify all the jobs that
'start on startup'. To determine that list of jobs:
initctl show-config -e|egrep -v "\<emits\>"|grep -B1 " start on startup"|egrep -v "(start on|^--)"
However it might be easier and simpler to start your system with Upstart by adding the following to
the kernel command-line:
--startup-event=foo
...and then having your job do:
start on foo
emits startup
script
# copy /var here.
end script
post-stop script
# kick off the rest of the system
initctl emit startup
end script
This is in fact essentially what friendly-recovery does in recent versions on Ubuntu.
See: http://upstart.ubuntu.com/cookbook/#command-line-options
Kind regards,
James.
--
James Hunt
____________________________________
http://upstart.ubuntu.com/cookbook
http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf
More information about the upstart-devel
mailing list