CONCEPTUAL OVERVIEW =================== EVENTS Events are things that occur at a point in time Events are named (one string) Events carry additional parameters (zero or more parameter name - parameter value pairs where the names and values are strings and the names are distinct) Events may be originated by - upstart due to statevar changes - initctl - upstart config STATEVARS Have a name (one string) Have a state (a string) at each point in time If no state yet set, state is the empty string May be defined by abstract state machines, jobs, or implicitly by reference and set with `set' or `initctl'. Whenever the state changes, an event is generated; the event has the same name as the statevar one parameter, = Every possible statevar is taken to exist; ones that haven't been set have the state `'. STATE MACHINES (MACHINES) May be - abstract state machines - jobs (control one or more processes) Define/reference an identically-named statevar Defined by an upstart config file leafnamed or which says machine JOBS A job is a state machine with defscript or defexec directives It references a statevar /goal whose value must be `start' or `stop' and which starts out as `stop' (instead of `') It generates a statevar whose value is one of stopped starting started stopping and which may not be set other than by upstart. CONFIG SYNTAX AND SEMANTICS =========================== LEXICAL SYNTAX file is series of lines #-comments \-continuation tokens are generally whitespace-separated words or `=' (unquoted string tokens do not contain punctuation other than `-' `_' `.' `/' and any other than `=' `#' `\' is currently a syntax error) unquoted strings may be keywords or values (eg, identifiers, globs, etc.) ""-quoted strings are identifiers or globs etc. ""-quoted strings may contain \" and \\ when a ""-quoted string is a glob the un-dequoted innards are used as the glob pattern (so we only have one lot of \-removal) except that \" is replaced with " and \$ with $ glob patterns match . at start glob patterns may contain [..] [^...] * ? and use \-quoting too FILES Each file defines a state machine whose name is ; if there are defscript or defexec directives it's a job. CONTEXT DIRECTIVE machine as if rest of file were another file with leafname ENTRYPOINT DIRECTIVES on [as ] [when ] when (happens when goes from false to true) defstate