Please feel free to comment on any aspect of this page, and add your own arguments for and against.

Should a job that is started manually be stopped automatically?

Should you be able to manually start a job that wouldn't be started automatically?

Restore Runlevel Control from the Kernel command line

Upstart should support allowing the user to select the default runlevel from the kernel command line. The following script, which is designed for Ubuntu 8.04 (Hardy Heron), allows upstart to set the runlevel based on kernel command line parameters. This script would replace /etc/event.d/rc-default:

# rc - runlevel compatibility
# /etc/event.d/rc-default
#
# This task guesses what the "default runlevel" should be and starts the
# appropriate script.
#
# From the kernel command line, specify a desired runlevel by
# writing "init" followed by the runlevel number. For example, you would
# do this for entering runlevel 3:
# kernel /boot/vmlinuz root=/dev/sda1 ro init 3

start on stopped rcS

script
        runlevel --reboot || true

        RL="$(sed -ne 's/.*init \([2-5S]\).*/\1/p' /proc/cmdline || true)"

        if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
            telinit S
        elif [ -n "$RL" ]; then
            telinit $RL
        elif [ -r /etc/inittab ]; then
            RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)"
            if [ -n "$RL" ]; then
                telinit $RL
            else
                telinit 2
            fi
        else
            telinit 2
        fi
end script
# vim: sts=4


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