summaryrefslogtreecommitdiff
path: root/core/runit/runit-2
blob: e36d340f0b79af4bdd2dccc29c6dc7ea110abfdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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: ........................................................................................................'