initscript emulation layer fails on start/stop/restart for jobs that don't spawn long lived processes

Bug #689820 reported by John Morrissey
4
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upstart (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

/lib/init/upstart-job doesn't perform the requested stop/start/restart action for Upstart jobs that don't spawn long-lived processes.

For example, qemu-kvm's upstart job doesn't start any daemons, but rather its pre-start script sets some sysctls and loads kernel modules, and its post-stop script removes those modules. Its job scripts never get called when the init script emulation (/etc/init.d, invoke-rc.d(8)) is used, since no process is associated with the job.

This seems to be the case even in the most recent upstart, in natty (0.6.6-3).

start|stop|restart)
[...]
    PID=$(status "$JOB" 2>/dev/null | awk '/[0-9]$/ { print $NF }')
    if [ -z "$PID" ] && [ "$COMMAND" = "stop" ]; then
        exit 0
    elif [ -n "$PID" ] && [ "$COMMAND" = "start" ]; then
        exit 0
    elif [ -z "$PID" ] && [ "$COMMAND" = "restart" ]; then
        start "$JOB"
        exit 0
    fi

Tags: natty
Revision history for this message
Scott James Remnant (scott) wrote :

Moved to Ubuntu bug tracker

Changed in upstart:
status: New → Invalid
affects: upstart → null
Curtis Hovey (sinzui)
no longer affects: null
Revision history for this message
Thomas Hood (jdthood) wrote :

It looks to me as if the quoted code will fail to stop and restart, but it shouldn't fail to start.

In any case, the code in upstart 1.4 looks rather different.

Thomas Hood (jdthood)
Changed in upstart (Ubuntu):
status: New → Confirmed
tags: added: natty
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.