# rc - runlevel compatibility # # This task guesses what the "default runlevel" should be and starts the # appropriate script. # # Modified from Ubuntu/gutsy version 2008-02-21 by Emmet Caulfield. # start on stopped rcS script runlevel --reboot || true RL="$(sed -ne 's/.*init \([2-5S]\).*/\1/;p' /proc/cmdline || true)" if [ -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