Ubuntu – Sense of “stop on…” stanza when job is a task

eventsupstart

an upstart question (I think I have read all relevant man pages but could not find the answer there): What is the sense of using a "stop on …" stanza in the definition of a job which is a task?

The manuals tell us that such a job, after being started, just waits until its script (or exec stanza) is executed completely, and then stops automatically. Given that, what is the point in using "stop on …" stanzas in such job definitions?

For example, this is the job definition for Upstart's (very important) rc job in Natty 11.04 (leaving out comments and empty lines):

start on runlevel [0123456]
stop on runlevel [!$RUNLEVEL]
export RUNLEVEL
export PREVLEVEL
console output
env INIT_VERBOSE
task
exec /etc/init.d/rc $RUNLEVEL

IMHO, the job, after being started by a runlevel event, will be stopped automatically as soon as /etc/init.d/rc $RUNLEVEL has finished.

Thank you very much for any explanation!

Best Answer

That would abort the task; if you tell the system to reboot because of a failure of some kind while bringing the system up, you generally don't want it to finish trying to boot first, or (worse) try to bring the system up and shut it down at the same time.

Related Question