Injecting a sequential job

Svein Seldal sveinse at seldal.com
Wed Feb 29 22:34:02 UTC 2012


More specifically, if I have a job like this:

start on starting dbus
task
script
	# Main script here...

	if [ "$production-mode" ]; then
	    initctl stop -n network-manager
	fi

	# Disable network-manager
end script

This does not work, as network-manager isn't started yet. NM depends on 
started dbus, which hasen't happened yet.

Is it at all possible to tell upstart not to start a future job without 
having to reload its config?


- Svein


On 29. feb. 2012 23:12, Svein Seldal wrote:
> Hi Steve
>
> Thanks for answering.
>
>> Could you provide some more detail about what the job is that you're
>> trying
>> to run? There's probably a solution that lets you achieve your end goal,
>> but would need to know what that end goal is to provide useful guidance
>> here.
>
> Yes sure. A bit complex I'd amit. I hope you can bear with me:
>
> Its an embedded product which has two distinct modes to run in:
> production mode and normal application mode. Application mode is
> standard rc runlevel as on a normal desktop installation. The production
> mode is a special mode used in production where no normal services
> should start except a few handpicked ones (static eth0, ssh).
>
> The decision between prod.mode is done from a script. I've been
> experimenting with starting this as a job task. One of the purposes in
> production mode is to have a very specific network setting and publish
> this on avahi.
>
> In app mode network manager provides the user's network configuration.
> One of the challenges I'm facing is how to handle network manager in
> production mode. NM holds the user's config and not the network setup
> needed in production mode. NM starts very early (even before any
> net-device-up is emitted), thus I'm experiencing a race between my
> script and NM.
>
> I've been experimenting with "start on starting dbus" (which is a common
> denominator between nm and avahi) to be able to stop nm and set the
> network manually when going to prod.mode. Yet this has a hacky feel to
> it. This script is vital for the product, so it needs to be simple.
> Complex rules will fail.
>
>
> Svein
>




More information about the upstart-devel mailing list