Re: sv check exit code not always helpful

From: Colin Booth <cathexis_at_gmail.com>
Date: Sun, 8 Feb 2015 00:12:45 -0800

>
> From the documentation, I had expected check to fail as long as the actual
> state didn't match the desired state, ie if there is any "want" clause. I'm
> using `sv` check to wait for runit to reach a steady state before using
> services.

`sv check' only exits non-zero if the following are both true:
The service is in the up state
A check script exists and exits non-zero.

Check is, I believe, intended to cover the ground between when runsv
considers the service up (in state run) and when the service has
completed initialization. This is important for things like databases
that might take a while to be ready.

To get the functionality you want the dependent service should, as
part of its runscript, do something like 'sv status $otherservice |
grep "run"' to see if runsv considers the service to be running
followed by a call to 'sv check $service' to see if the service is
available.

Cheers!

-- 
"If the doors of perception were cleansed every thing would appear to
man as it is, infinite. For man has closed himself up, till he sees
all things thru' narrow chinks of his cavern."
  --  William Blake
Received on Sun Feb 08 2015 - 08:12:45 UTC

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