summaryrefslogtreecommitdiff
path: root/core/runit/runit-2
diff options
context:
space:
mode:
Diffstat (limited to 'core/runit/runit-2')
-rw-r--r--core/runit/runit-222
1 files changed, 22 insertions, 0 deletions
diff --git a/core/runit/runit-2 b/core/runit/runit-2
new file mode 100644
index 0000000..e36d340
--- /dev/null
+++ b/core/runit/runit-2
@@ -0,0 +1,22 @@
+#!/bin/sh
+# /etc/runit/2 - Start service supervision
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+export PATH
+
+runlevel=default
+
+for arg in $(cat /proc/cmdline); do
+ if [ -d "/etc/runit/runsvdir/$arg" ]; then
+ printf "Runlevel: %s\n" "$arg"
+ runlevel="$arg"
+ break
+ fi
+done
+
+runsvchdir "$runlevel" || {
+ printf "Warning: runlevel '%s' failed, falling back to 'default'\n" "$runlevel"
+ [ "$runlevel" != default ] && runsvchdir default
+}
+
+exec runsvdir -P /service 'log: ........................................................................................................'