Dependencies

Scott James Remnant scott at netsplit.com
Mon Jul 6 16:22:07 BST 2009


On Mon, 2009-07-06 at 17:48 +0300, Иво Георгиев wrote:

> Does Upstart support job dependencies and will it support? I mean, for
> example, on event "runlevel 3", all the jobs for runlevel 3 are
> started, but can the job be configured to start on event "runlevel 3",
> when other job is started. Also, can I configure the job to be started
> in a few events, not only one.
> 
Each of the different series of Upstart approach this in a different
way.

In 0.3.x, it's only possible to be started by a single event, out of a
choice of many.  This matches the sysvinit behaviour, any one of the
following runlevels are sufficient to start the job:

	start on runlevel 2
	start on runlevel 3
	start on runlevel 4
	start on runlevel 5

You can never be running in two runlevels simultaneously.


In 0.5.x/0.6.x, it's now possible to be started by a combination of
events through the "and" & "or" keywords.  So you can now:

	start on started apache and started tomcat
	stop on stopping apache or stopping tomcat

Obviously it takes some care to get the pairings right, but this allows
you to express multiple requirements.


In 0.10.x, the planned syntax is much easier to use:

	while apache and tomcat

And this has the added bonus that when started manually, this job can
actually start apache and/or tomcat if required.  This makes it behave a
little more like a dependency-based system, but only in this particular
circumstance.


Otherwise Upstart is still an event-based system, not a dependency-based
one.  What I mean by this is how the services are processes.

A dependency-based system has goal services; you know when you start out
that you want "gdm, apache and bind" running.  You calculate the
dependencies of those services, and apply ordering, to figure out what
you need to start and in what order.

If a service is neither a goal nor a dependency of another, it won't be
started.

(compare with the behaviour of a package manager)


An event-based system like Upstart does things in the exact opposite
order.  Services are started as a result of conditions they state
becoming true, there's no "goal" services - whatever is started is
whatever can be started given the current conditions.


Scott
-- 
Have you ever, ever felt like this?
Had strange things happen?  Are you going round the twist?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/upstart-devel/attachments/20090706/c6e009e8/attachment.pgp 


More information about the upstart-devel mailing list