conditonal events to start a script?

Sean Russell upstart at ser1.net
Mon Oct 30 21:07:19 GMT 2006


On Monday 30 October 2006 14:29, paul wrote:
>  In trying to think of events to boot my systems with upstart I
> stumbled over the following problem. On one machine I have the

You may want to look back through the mailing list archives; there's 
been an ongoing discussion about multiple event requirements and 
conditional events.

> X-font-server (xfs) installed, but not on the other. Thus on one
> machine I can start X only after xfs, but the other should not wait
> (there it does not exists). I want to use the same scripts (in case
> you want to provide the scripts for a distribution for example). So
> we need not only have multiple events to start a script, but also
> conditional multiple events.
>
>  Would it make sense to implement something like the example below?
>
>  xdm script:
>  start on ( filesystem.writable AND
>             IFEXISTS xfs/stop AND
>             IFEXISTS hald/stop AND
>             IFEXISTS netmount/stop )
>
>  script
>      ...
>      /usr/bin/xdm
>      ...
>  end script

An alternative syntax to the one you propose is less capable, but is 
easier to parse:

	start on filesystem.writable xfs/stop? hald/stop? netmount/stop?

I think about this problem as determining sufficiency for a service.  
Sufficiency is met when (a) all of the required services have been 
started and (b) when all of the optional services are either missing, 
or fail to start (a-la a failure event).

I started a wiki page about this issue, but as I'm in the middle of an 
unrelated software release, I haven't had time to fill it in yet.

	https://wiki.ubuntu.com/in-Upstart_proposal

>  The IFEXISTS keyword tells the script to only wait for a xfs/stop
> event if xfs is known to upstart. Maybe the most simple  way to do
> this is to check if there is a script in /etc/event.d with the name
> xfs. Of course the xfs script should only be installed in
> /etc/event.d when the xfs package is installed.
>
>  Other examples are:
>  - nfs should wait for quota if it exists
>  - gkrellmd should wait for lm_sensors if it exists
>  - hald should wait for dns if it exists.
>
>  Does this make sense, or is there an other simpler way of doing
> this?
>
>  Paul
>
>  PS for Gentoo-ers, this is know as 'after'

--- SER



More information about the Upstart-devel mailing list