Comment 1 for bug 390391

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Right now, 0.3 has the UPSTART_EVENT environment variable that it passes to the stop script so that it knows which event stopped the job.

0.5 dropped this, only passing an UPSTART_STOP_EVENTS and accompanying environment to the pre-stop script, not the post-stop script. I didn't think it was necessary.

The recent change to the default rcS-sulogin script shows why it us - we check whether being stopped by the "runlevel" event there to decide whether or not to switch the runlevel.

Neither pass "failed" information to pre-stop or post-stop.

We need some generic way to solve this in both directions.

Both the stop events or failed information needs to be given to pre-stop and post-stop so the job itself can react to things differently.

    post-stop script
        [ "$UPSTART_STOP_EVENT" = "..." ] && ...
        [ "$UPSTART_EXIT_SIGNAL" = "TERM" ] & ....
    end script

Alternatively the stop events or failed information needs to be present in the "stopping"/"stopped" events so that other jobs can react to things.

    on stopped other-job
    script
        [ "$STOP_EVENT" = "..." ] && ...
        [ "$EXIT_SIGNAL" = "TERM" ] & ....
    end script

The latter is probably more upstart-y, since then you can match things:

    on stopped some-job STOP_EVENT="runlevel 6"