Event Summary
This manual page summarizes well-known events generated by Upstart running both as the init(8) daemon (process ID 1) and a Session Init (process that supervises a user session).
It is not an exhaustive list of all possible events, but rather details a standard set of events expected to be generated on any Ubuntu system running Upstart.
The primary tables, Table 1 and Table 2, encode the well-known system and session events respectively, along with the type of each event (listed in Table 3), the emitter of the event (see Table 4) and the approximate time at which the event could be generated. Additionally, the Note column indexes into Table 5 for further details on a particular event.
Table 6 shows job goals and possible state transitions. See the status command in initctl(8) for further details.
Note that some events listed in Table 1 may be available to session jobs (depending on when the Session Init starts). Those events that are available will be prefixed with :sys:. See upstart-event-bridge(8) for further details.
The Ref (Reference) column is used to refer to individual events succinctly in the Time column.
Note that the '<' and '>' characters in the Time column denote that the event in the Event column occurs respectively before or after the event specified in the Time column (for example, the mounting(7) event occurs "at some time" after the startup(7) event, and the virtual-filesystems(7) event occurs after the last mounted(7) event relating to a virtual filesystem has been emitted).
For further details on events, consult the manual pages and the system job configuration files, usually located in /etc/init.
Table 1: Well-Known System Events Summary.
|
Key:
'DM' is an abbreviation for Display Manager.
'FS' is an abbreviation for filesystem.
'IF' is an abbreviation for Network Interface.
Table 2: Well-Known User Events Summary.
|
Table 3: Event Types.
|
Table 4: Event Emitters.
|
Table 5: Event Summary Notes.
|
Job States
Table 6: Job Goals and State Transitions.
|
Key:
(*) If there is a script or exec section and this process is running,
state will be 'pre-stop', else it will be 'stopping'.
Job Lifecycle
Starting a Job
- step]
- Initially the job is "at rest" with a goal of 'stop' and a state of 'waiting' (shown as 'stop/waiting' by the initctl(8) list and status commands).
- step]
- The goal is changed from 'stop' to 'start' indicating the job is attempting to start.
- step]
- The state is changed from 'waiting' to 'starting'.
- step]
- The starting(7) event is emitted denoting the job is "about to start".
- step]
- Any jobs whose 'start on' (or 'stop on') condition would be satisfied by this job starting are started (or stopped respectively).
- step]
- The starting(7) event completes.
- step]
- The state is changed from 'starting' to 'pre-start'.
- step]
- If the pre-start stanza exists, the pre-start process is spawned.
- step]
- If the pre-start process fails, the goal is changed from 'start' to 'stop', and the stopping(7) and stopped(7) events are emitted with appropriate variables set denoting the error.
- step]
- Assuming the pre-start did not fail or did not call "stop", the main process is spawned.
- step]
- The state is changed from 'pre-start' to 'spawned'.
- step]
- Upstart then ascertains the final PID for the job which may be a descendent of the immediate child process if expect fork or expect daemon has been specified.
- step]
- The state is changed from 'spawned' to 'post-start'.
- step]
- If the post-start stanza exists, the post-start process is spawned.
- step]
- The state is changed from 'post-start' to 'running'.
- step]
-
The started(7) event is emitted.
For services, when this event completes the main process will now be fully running. If the job refers to a task, it will now have completed (successfully or otherwise).
- step]
-
Any jobs whose 'start on' (or 'stop on') condition would be satisfied
by this job being started are started (or stopped respectively).
Stopping a Job
- step]
- Assuming the job is fully running, it will have a goal of 'start' and a state of 'running' (shown as 'start/running' by the initctl(8) list and status commands).
- step]
- The goal is changed from 'start' to 'stop' indicating the job is attempting to stop.
- step]
- The state is changed from 'running' to 'pre-stop'.
- step]
- If the pre-stop stanza exists, the pre-stop process is spawned.
- step]
- The state is changed from 'pre-stop' to 'stopping'.
- step]
- The stopping(7) event is emitted.
- step]
- Any jobs whose 'start on' (or 'stop on') condition would be satisfied by this job stopping are started (or stopped respectively).
- step]
-
The main process is stopped:
-
- step2]
- The signal specified by the kill signal stanza is sent to the process group of the main process (such that all processes belonging to the jobs main process are killed). By default this signal is SIGTERM.
- step2]
- Upstart waits for up to "kill timeout" seconds (default 5 seconds) for the process to end.
- step2]
- If the process is still running after the timeout, a SIGKILL signal is sent to the process which cannot be ignored and will forcibly stop the processes in the process group.
-
- step]
- The state is changed from 'killed' to 'post-stop'.
- step]
- If the post-stop stanza exists, the post-stop process is spawned.
- step]
- The state is changed from 'post-stop' to 'waiting'.
- step]
-
The stopped(7) event is emitted.
When this event completes, the job is fully stopped.
- step]
-
Any jobs whose 'start on' (or 'stop on') condition would be satisfied
by this job being stopped are started (or stopped respectively).
AUTHOR
Manual page written by James Hunt <[email protected]>REPORTING BUGS
Report bugs at <https://launchpad.net/ubuntu/+source/upstart/+bugs>COPYRIGHT
Copyright © 2011-2013 Canonical Ltd.This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.