Re: runit problem with sv check? Or misreading the manual page?

From: Luke Diamand <luke_at_diamand.org>
Date: Sun, 04 Jan 2015 22:31:58 +0000

Thanks,

Checking for non-empty ypwhich output seems to do the trick.

(ypwhich will write an error message to stderr and nothing to stdout if
ypbind is not running at all, but will hang if ypbind is trying to find
a working server).




On 04/01/15 20:29, Avery Payne wrote:
> On Sat, Jan 3, 2015 at 4:05 AM, Luke Diamand <luke_at_diamand.org> wrote:
>
>> I'm trying to write a ./run file for autofs which will wait for ypbind to
>> come up before starting autofs.
>>
>> I've got a line in autofs/run that says:
>>
>> sv check ypbind
>>
>> and then a ./check script inside the ypbind directory which runs ypwhich.
>>
>
> From http://smarden.org/runit/sv.8.html we get this snippet: "If the
> requested state of the service is *up*, and the script *./check* exists in
> the service directory, *sv* runs this script to check whether the service
> is up and running; it’s considered to be up if *./check* exits with 0."
>
> So you need a "sv start ypbind" before you can "sv check ypbind".
>
> Does your check script look like this?
>
> timeout 1 ypwhich
>
>
> The manpage for ypwhich says that the command returns a name, which implies
> a string inside of a shell.
>
> Try this:
>
> SERVERNAME=$(ypwhich)
> test -n $SERVERNAME && exit 0
> exit 1
>
> ...or something like that. I am working under the assumption that ypwhich
> returns a blank string if there is no server.
>
Received on Sun Jan 04 2015 - 22:31:58 UTC

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