Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Upstart provides support for starting jobs based on an events arguments:

start on custom-event NAME=foo

This will only start the job when custom-event is emitted and the argument NAME has the value foo.

It also provides as way to start on a set of arguments:

start on custom-event QUANTITY=[12]

This will only start the job when custom-event is emitted argument QUANTITY has either value 1 or 2.

I can't figure out how to provide a relation operator:

start on coretemp TEMP>60
stop on  coretemp TEMP<50

The idea here is to start this job (a task really) when the cpu core temp gets too large.

I would not be surprised if upstart did not yet support arithmetic relation operators. However this syntax does not work either.

start on coretemp TEMP=[60,61,62,63,...,79,80]
stop on  coretemp TEMP=[30,31,32,33,...,49,50]

Am I way off base, trying to make upstart do something it was never meant to do?

So far my only workable solution is to have my temperature monitoring daemon emit custom events:

share|improve this question
+1 For trying this. – Richard Holloway Aug 11 '10 at 23:30

It looks to me like, to be blunt, "You're doing it wrong." :)

There shouldn't be configuration logic in the startup scripts - it should be in configuration files. So your temperature-monitoring daemon should emit coretemp-too-hot and coretemp-nominal and have a config file that specifies what the breakpoint for that is. That way you just change the values in the config file (one place that multiple apps can look at it, if need be) instead of having to edit your upstart files.

Or if you want to ignore me (on your own head be it!), you might try:

start on coretemp TEMP=[678][0123456789]
stop on coretemp  TEMP=[34][0123456789]

which is about as close as I think you're going to be able to get.

share|improve this answer
It turns out 'coretemp-too-hot' is just the opposite of what I want. My script is to assist with device burn in. It only turns on the CPU roasting program when the temperature gets above 60C. I could instead emit a signal 'cpu-hot-enough', but I don't like that either. I was hoping to get my temperature emitter to act like a udev event. – deft_code Aug 24 '10 at 1:07
up vote 0 down vote accepted

I'd still like to have relational operators to use with Upstart's start/stop on conditions. However, it looks like I was over thinking the problem.

My solution was to have the temperature monitoring daemon emit a coretemp event with each degree of change. ie If the the temperature jumps from 50° to 55°, the daemon emits 51, 52, 53, 54, and 55. Then the start on condition for the roast program becomes simple

start on coretemp TEMPERATURE=60
stop on coretemp TEMPERATURE=50
exec cpuroast

The only downside is that at start up the script blasts out a bunch of temperature events. In my case all temps between 25° and initial temp. I have to do this in case the system is booted when the ambient temperature is above 60°.

share|improve this answer
I still disagree with putting config info into the startup scripts. Put the actual start/stop numbers into like an /etc/default/cpuroast file that your startup script sources; that way you don't have to touch the startup script ever again, you just have to change the config file. – pjz Aug 25 '10 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.