From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-user+bounces-145699-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 31844198005
	for <garchives@archives.gentoo.org>; Fri,  8 Mar 2013 04:30:56 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 77E0AE0730;
	Fri,  8 Mar 2013 04:30:46 +0000 (UTC)
Received: from svr-us4.tirtonadi.com (svr-us4.tirtonadi.com [69.65.43.212])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 2BF6FE0654
	for <gentoo-user@lists.gentoo.org>; Fri,  8 Mar 2013 04:30:44 +0000 (UTC)
Received: from mail-vb0-f44.google.com ([209.85.212.44]:40068)
	by svr-us4.tirtonadi.com with esmtpsa (TLSv1:RC4-SHA:128)
	(Exim 4.80)
	(envelope-from <pandu@poluan.info>)
	id 1UDoxB-002mdT-69
	for gentoo-user@lists.gentoo.org; Fri, 08 Mar 2013 11:30:45 +0700
Received: by mail-vb0-f44.google.com with SMTP id fr13so496397vbb.3
        for <gentoo-user@lists.gentoo.org>; Thu, 07 Mar 2013 20:30:42 -0800 (PST)
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
X-Received: by 10.52.67.105 with SMTP id m9mr296850vdt.128.1362717042895; Thu,
 07 Mar 2013 20:30:42 -0800 (PST)
Received: by 10.220.36.195 with HTTP; Thu, 7 Mar 2013 20:30:42 -0800 (PST)
Received: by 10.220.36.195 with HTTP; Thu, 7 Mar 2013 20:30:42 -0800 (PST)
In-Reply-To: <51391398.1030100@gmail.com>
References: <51391398.1030100@gmail.com>
Date: Fri, 8 Mar 2013 11:30:42 +0700
Message-ID: <CAA2qdGVHxS1NgtCgpbDhNoTfWPK-szgRJCN_yae5e_EenTYNxA@mail.gmail.com>
Subject: Re: [gentoo-user] /etc/hosts include file?
From: Pandu Poluan <pandu@poluan.info>
To: gentoo-user@lists.gentoo.org
Content-Type: multipart/alternative; boundary=20cf307d025445a1f004d762494a
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - svr-us4.tirtonadi.com
X-AntiAbuse: Original Domain - lists.gentoo.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - poluan.info
X-Get-Message-Sender-Via: svr-us4.tirtonadi.com: authenticated_id: rileyer+pandu.poluan.info/only user confirmed/virtual account not confirmed
X-Archives-Salt: 0f7dff64-e3fc-4b83-ad6c-319a9e3c9ee0
X-Archives-Hash: 1b7ea1ce157c29501ec0379d4efee922

--20cf307d025445a1f004d762494a
Content-Type: text/plain; charset=UTF-8

On Mar 8, 2013 5:27 AM, "Alan McKinnon" <alan.mckinnon@gmail.com> wrote:
>
> Anyone know if there's a way to get /etc/hosts to support the notion of
> an include file? I did my homework and found nothing, maybe someone else
> knows more.
>
> I really do need this, I have an app that discovers things on the
> network and knows their address. This makes it's automated way into DNS
> but takes a few days, and another app needs to use the fqdn right now.
> So /etc/hosts is the way to go for the interim three days.
>
> I've worked around it by creating /etc/hosts.d/ containing a header and
> a data file. cat the two and redirect to /etc/hosts.d/hosts and the real
> hosts file is a symlink to that. It's a sub-directory as none of these
> apps run as root and only root can modiy the real hosts file.
>
> This works well enough, but a supported include mechanism would make
> life so much simpler, not to mention easier for my colleagues to
> understand what the blazes I set up :-)
>
>
>
> --
> Alan McKinnon
> alan.mckinnon@gmail.com
>
>
>

An option would be to create a cron job which generates the hosts file
every minute. The cron job should also insert a header on top of the hosts
file telling:

+ this file (hosts) is dynamically generated
+ by a system cron job
+ the cron job's script location

Besides, you said you're going to need this workaround only for a couple of
days, so installing Samba4 might be an overkill.


Rgds,
--

--20cf307d025445a1f004d762494a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p><br>
On Mar 8, 2013 5:27 AM, &quot;Alan McKinnon&quot; &lt;<a href=3D"mailto:ala=
n.mckinnon@gmail.com">alan.mckinnon@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Anyone know if there&#39;s a way to get /etc/hosts to support the noti=
on of<br>
&gt; an include file? I did my homework and found nothing, maybe someone el=
se<br>
&gt; knows more.<br>
&gt;<br>
&gt; I really do need this, I have an app that discovers things on the<br>
&gt; network and knows their address. This makes it&#39;s automated way int=
o DNS<br>
&gt; but takes a few days, and another app needs to use the fqdn right now.=
<br>
&gt; So /etc/hosts is the way to go for the interim three days.<br>
&gt;<br>
&gt; I&#39;ve worked around it by creating /etc/hosts.d/ containing a heade=
r and<br>
&gt; a data file. cat the two and redirect to /etc/hosts.d/hosts and the re=
al<br>
&gt; hosts file is a symlink to that. It&#39;s a sub-directory as none of t=
hese<br>
&gt; apps run as root and only root can modiy the real hosts file.<br>
&gt;<br>
&gt; This works well enough, but a supported include mechanism would make<b=
r>
&gt; life so much simpler, not to mention easier for my colleagues to<br>
&gt; understand what the blazes I set up :-)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Alan McKinnon<br>
&gt; <a href=3D"mailto:alan.mckinnon@gmail.com">alan.mckinnon@gmail.com</a>=
<br>
&gt;<br>
&gt;<br>
&gt;</p>
<p>An option would be to create a cron job which generates the hosts file e=
very minute. The cron job should also insert a header on top of the hosts f=
ile telling:</p>
<p>+ this file (hosts) is dynamically generated<br>
+ by a system cron job<br>
+ the cron job&#39;s script location</p>
<p>Besides, you said you&#39;re going to need this workaround only for a co=
uple of days, so installing Samba4 might be an overkill.<br>
=C2=A0=C2=A0 </p>
<p>Rgds,<br>
--<br>
</p>

--20cf307d025445a1f004d762494a--