diff options
Diffstat (limited to 'event.d/rc-default')
-rw-r--r-- | event.d/rc-default | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/event.d/rc-default b/event.d/rc-default new file mode 100644 index 00000000..9160062b --- /dev/null +++ b/event.d/rc-default @@ -0,0 +1,22 @@ +# rc - runlevel compatibility +# +# This task guesses what the "default runlevel" should be and starts the +# appropriate script. + +start on stopped rcS + +script + runlevel --reboot || true + + RL="2" + if [ -r /etc/inittab ]; then + RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" /etc/inittab || true)" + fi + for t in $(cat /proc/cmdline); do + case $t in + -s|single|S) RL="S" ;; + [1-9]) RL="$t" ;; + esac + done + telinit $RL +end script |