help-cfengine
[Top][All Lists]
Advanced

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

Re: dealing with multiple domains


From: Andrew Stribblehill
Subject: Re: dealing with multiple domains
Date: Tue, 11 Feb 2003 09:51:59 +0000
User-agent: Mutt/1.4i

Quoting Chris Edillon <jce@zot.com> (2003-02-11 02:54:37 GMT):
> 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.

This may be of use:

awk '$1=="search"{s=s?s:$2} $1=="domain"{s=$2} END{print 
s?s:"undefined.domain"}'

-- 
PORTLAND PLYMOUTH
CYCLONIC 4 OR 5 BECOMING NORTHEASTERLY 3 OR 4. RAIN CLEARING.
MODERATE OR POOR BECOMING GOOD




reply via email to

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