Comment 2 for bug 616575

Revision history for this message
Scott James Remnant (scott) wrote : Re: [Bug 616575] Re: support relation operators in env matches of start/stop conditions

The trouble with operators like "<", ">", etc. is that their meaning
varies depending on your interpretation of the following string.

It may be that dpkg-ish version comparisons are the right way forward
here, since they split strings and numbers according to a well-defined
spec that is actually almost always want you want. It would mean that
the following would work:

  start on cputemp TEMP<60
  start on sysinit JOB>=S15
  start on started apache VERSION>2.1-5ubuntu4

Scott

On Tue, Mar 8, 2011 at 6:39 AM, Clint Byrum <email address hidden> wrote:
> Forwarding this to the upstream upstart project and marking
> Triaged/Wishlist in Ubuntu.
>
> ** Also affects: upstart
>   Importance: Undecided
>       Status: New
>
> ** Summary changed:
>
> - support relation operators in env matches of start/stop conditions
> + init: support relation operators in env matches of start/stop conditions
>
> ** Changed in: upstart (Ubuntu)
>       Status: New => Triaged
>
> ** Changed in: upstart (Ubuntu)
>   Importance: Undecided => Wishlist
>
> --
> You received this bug notification because you are a member of Upstart
> Developers, which is subscribed to upstart .
> https://bugs.launchpad.net/bugs/616575
>
> Title:
>  init: support relation operators in env matches of start/stop
>  conditions
>
> Status in Upstart:
>  New
> Status in “upstart” package in Ubuntu:
>  Triaged
>
> Bug description:
>  Binary package hint: upstart
>
>  Adding support for relation operators in the start/stop on stanza will
>  benefit future upstart scripts.  In particular it will help when
>  upstart's scope grows to encompass cron and udev style services.
>
>  My particular use case:
>  a temperature monitoring daemon which emits events along the lines of
>
>  initctl emit coretemp TEMP=37
>
>  A second daemon that starts/stops depending on the current
>  temperature.
>
>  it could have a .conf file
>
>  #cpu is too hot
>  start on cputemp TEMP>60
>  stop on cputemp TEMP<50
>
>  respawn
>  exec cpu-is-too-hot
>
>
>  It is currently very unwieldy to produce the start/stop on stanzas with only the equality comparisons.
>
>  start on cputemp TEMP=[6789][0123456789]
>  stop on cputemp TEMP=[1234][0123456789]
>  These do not even cover all the cases.
>
>  In general more powerful env matching syntax would help tremendously,
>  adding relation operators should just be a first step.
>