#!/bin/sh # Invoke runsvdir, the normal runit stage 2. # Calling `runsvchdir default` here doesn't do this, unfortunately. ln -s "./default" /etc/runit/runsvdir/current # Try to avoid supervised services flooding the active tty with their stdout by # redirecting it elsewhere. The right thing to do instead of relying on this is # configuring syslog or svlogd in each service so their stdout never ends up # here in the first place, but doing so isn't always practical. for console_device in /dev/tty12 /dev/ttyS1 /dev/kmsg; do if [ -c "${console_device}" ]; then echo "Redirecting runsvdir output to ${console_device}" >&2 # shellcheck disable=SC2094 exec <>"${console_device}" >"${console_device}" 2>"${console_device}" break fi done exec runsvdir -P /service