Differences between revisions 4 and 5
Revision 4 as of 2006-11-29 11:34:35
Size: 1959
Editor: scott
Comment: fix up
Revision 5 as of 2011-08-26 04:10:18
Size: 1959
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

This specification proposes exporting an environment variable to all job processes so that it is possible for scripts and binaries to determine which job they are being run within.

Rationale

Jobs will frequently use libraries of functions or helper tools that may wish to adjust their behaviour depending on the job being run. In particular, initctl may wish to act on the job it's being called from by default.

Use cases

  • Common function or binary that changes behaviour for a certain job.
  • Allow calling of start or stop directly from a job without having to specify the job name.

Scope

The scope of this specification is limited to the addition and use of this environment variable.

Design

  • The name of the job is placed in the UPSTART_JOB environment variable for any process.

  • initctl commands that accept a job will default to UPSTART_JOB if none is given.

    pre-start script
        [ $DISABLED ] && stop
    end script
    
    post-stop script
        [ $RESPAWN ] && start
    end script

Implementation

Code

The environment variable will be seeded by modifying process_setup_environment in init/process.c.

start_action in util/initctl.c will be modified to check this variable when no arguments are given, and only error if the variable is also missing.

Data preservation and migration

These changes are backwards compatible with the previous behaviour.


CategorySpec

JobEnvironmentVariable (last edited 2011-08-26 04:10:18 by localhost)