Re: Runit questions

From: Steve Litt <>
Date: Tue, 11 Oct 2016 12:15:05 -0400

On Tue, 11 Oct 2016 11:53:38 +0200
Jan Bramkamp <> wrote:

> Runit doesn't track dependencies directly, but it can handle them.
> This is done by calling sv start $DEP_1 $DEP_2 etc. in the ./run
> script.

I've always done it differently, as shown in this run script:

if test_of_readiness_of_dep1; then
  exec this_daemon
sleep 1

So if $DEP_1 isn't ready, $THIS_DAEMON waits a second and then fails
and is soon tried again. For a dependency that takes huge amounts of
time, like dhcpcd, that sleep might be 15 instead of 1.

Your method is obviously more efficient and straightforward than mine.
My method theoretically could act like a bunch of ping pong balls on a
bunch of set mousetraps, although in practice I've never seen any
evidence of that. Your method sets off dependencies consecutively
rather than trial and error, and would seem to be superior, with two

1) My method can be used to test for any arbitrary definition of the
   dependency being "ready". For instance, my sshd service could run
   only after a successful ping of or of, thereby
   proving the network is up all the way to the Internet. This is much
   more specific than merely testing whether the networking system is

2) My method refuses to run $THIS_DAEMON if $DEP_1 is not functional,
   rather than starting $DEP_1 and assuming it will start correctly,
   instantly. My method refuses to run a daemon when its dependencies
   have serious problems.

I'm wondering if our methods could be combined:

sv start $DEP_1
if test_of_readiness_of_dep1; then
  exec this_daemon
sleep 1

In the preceding, $APPROPRIATE_SECONDS is probably a small fraction
like 0.1: Just enough time for $DEP_1 to become ready to do its job.

Steve Litt
September 2016 featured book: Twenty Eight Tales of Troubleshooting
Received on Tue Oct 11 2016 - 16:15:05 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC