runit

Vladimir Dronnikov dronnikov at gmail.com
Tue Nov 3 13:18:45 UTC 2009


Hello, Denys!

I'd like to discuss the drawback (feature?) of runit services
(http://busybox.net/~vda/init_vs_runsv.html) which has always been
inspiring me to make some changes:

runsv spoils service container directory with "supervise" directory --
pure runtime info which _should not_ survive between reboots -- thus
it's native place is /var/run/<service name>.
There too should go "supervise" or "service logger" subservice.

Suppose I have getty service (say, on tty1) and want its activity to
be logged. I should make:
/etc/init.d/getty1/
    run # service starter
    supervise/ is a symlink for /var/run/getty1/supervise
    log/
        run # logger subservice
        supervise/ is a symlink for /var/run/getty1/log/supervise

Furthermore, one can expect service logs under /var/log/<service
name>. To achieve that, logger service's run should be a symlink to a
generic enough script, which retrieves the name of parent service and
prepares /var/log/<service name>.

E.g. generic /usr/bin/log can be of form:
-------------
A=`pwd`
A=${A%/log}
A=${A##*/}
D=/var/log/$A
mkdir -p -m 750 $D && chown log:log $D && exec chpst -u log:log -- svlogd -tt $D
-------------

Furthermore, logger subservice then is invariant for any service, and
we can control whether to start it or not by placing, say, "nolog"
file marker into service directory, just like "down" file to control
service startup mode. That way, service's "run" can analyze the
presence of "nolog" marker and create logger subservice hierarchy
automagically.

Please, review.

TIA,
--
Vladimir


More information about the busybox mailing list