help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dealing with multiple domains


From: Nate Campi
Subject: Re: dealing with multiple domains
Date: Mon, 10 Feb 2003 19:20:48 -0800
User-agent: Mutt/1.3.28i

On Mon, Feb 10, 2003 at 10:54:37PM -0400, Chris Edillon wrote:
>   you can use ExecResult just fine though, so i'd write a small script
> which gets the domain from /etc/resolv.conf and use ExecResult:
> 
> control:
>     domain  =  ( ExecResult(/var/cfengine/scripts/getdomain) )
> 
> 
> #!/bin/sh
> # getdomain
> PATH=/bin
> echo `grep ^domain /etc/resolv.conf | awk '{print $2}'`
> 
> you might want to make the script more robust by checking for a
> search directive as well (assuming the proper domain is the first
> one listed in the search list), and returning "undefined.domain"
> if you can't figure it out from /etc/resolv.conf.

It's not robust to use resolv.conf in this way at all. I don't use
"domain" directives in that file on any of my hosts, since the "search"
directive conflicts the "domain" directive (and I use the "search"
directive).

 <URL:http://marc.theaimsgroup.com/?l=bind-users&m=104380458118448&w=2>

You might be able to rely on "domain" being in resolv.conf on each of
your hosts, though, so this could work at your site. Just be aware that
it's no guaranteed to work on all hosts.
-- 
Nate Campi    http://www.campin.net 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]