init: provide reason for stop to processes

Bug #390391 reported by Jort
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upstart
Triaged
Wishlist
Unassigned

Bug Description

This is more of a feature request, but I couldn't find the "feature request" page.

Is there any chance of a"failed" stanza:

failed script
    echo "Database failed to come up, Scott!!" | /usr/sbin/sendmail scott@localhost
end script

summary: - "failed" stanza?
+ init: provide reason for stop to processes
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"

Changed in upstart:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

I've done a band-aid fix for the upcoming 0.6.0 to supply the stop environment to the post-stop script, but the above still stands.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.