public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alan McKinnon <alan.mckinnon@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] /etc/hosts include file?
Date: Fri, 08 Mar 2013 10:23:31 +0200	[thread overview]
Message-ID: <5139A003.6030909@gmail.com> (raw)
In-Reply-To: <CAA2qdGVHxS1NgtCgpbDhNoTfWPK-szgRJCN_yae5e_EenTYNxA@mail.gmail.com>

On 08/03/2013 06:30, Pandu Poluan wrote:
> 
> On Mar 8, 2013 5:27 AM, "Alan McKinnon" <alan.mckinnon@gmail.com
> <mailto: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 <mailto: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.



I'm already doing something very much like that, I reckon I'll leave it
in place, and document it in the grand CYA tradition.

To be clear, it's not a temporary workaround - it's permanent. I do
network discovery every 12 hours and can find up to 7000 things on the
network, so now I know their hostname and address. This eventually makes
it's way into DNS, but DNS by design updates slowly and a second app (an
audit app) needs to resolve the names immediately. That's why hosts is
the perfect interim solution; in 3 days when the DNS update happens the
entry is removed from the hosts file.



-- 
-- 
Alan McKinnon
alan.mckinnon@gmail.com



      reply	other threads:[~2013-03-08  8:25 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-07 22:24 [gentoo-user] /etc/hosts include file? Alan McKinnon
2013-03-07 23:50 ` Michael Mol
2013-03-08  0:29 ` Michael Mol
2013-03-08  8:32   ` Alan McKinnon
2013-03-08 13:40     ` Michael Mol
2013-03-08 13:54       ` Alan McKinnon
2013-03-08 19:50         ` [Bulk] " Kevin Chadwick
2013-03-08 19:55           ` Michael Mol
2013-03-08 21:49             ` Kevin Chadwick
2013-03-08 22:36               ` Pandu Poluan
2013-03-09  0:50                 ` Kevin Chadwick
2013-03-09  3:27                   ` Michael Mol
2013-03-09 12:53                     ` Kevin Chadwick
2013-03-10 21:28                       ` Michael Mol
2013-03-11 23:09                         ` Kevin Chadwick
2013-03-12  5:05                           ` Michael Mol
2013-03-09  0:13               ` Walter Dnes
2013-03-09  0:41                 ` Michael Mol
2013-03-10  1:42                   ` Walter Dnes
2013-03-10  4:59                     ` Michael Orlitzky
2013-03-10 21:09                       ` Michael Mol
2013-03-10  5:19                     ` Alan McKinnon
2013-03-10 21:07                       ` Michael Mol
2013-03-10 21:43                         ` Alan McKinnon
2013-03-10 22:02                           ` Michael Mol
2013-03-11  4:00                         ` Walter Dnes
2013-03-11  4:37                           ` Michael Mol
2013-03-11  8:22                           ` Alan McKinnon
2013-03-11 22:45                             ` Walter Dnes
2013-03-11 23:39                               ` Kevin Chadwick
2013-03-12  3:58                                 ` Walter Dnes
2013-03-12  0:25                               ` Alan McKinnon
2013-03-12  2:02                               ` Michael Mol
2013-03-12 11:29                                 ` Alan McKinnon
2013-03-13  0:26                                   ` [Bulk] " Kevin Chadwick
2013-03-11 23:31                             ` Kevin Chadwick
2013-03-12  0:37                               ` Alan McKinnon
2013-03-09  0:45                 ` Kevin Chadwick
2013-03-09  3:21                   ` Michael Mol
2013-03-09 12:53                     ` Kevin Chadwick
2013-03-10 22:00                       ` Michael Mol
2013-03-11  1:56                         ` Michael Orlitzky
2013-03-11  2:33                           ` Michael Mol
2013-03-11 22:34                         ` Kevin Chadwick
2013-03-12  3:36                           ` Michael Mol
2013-03-08 15:39   ` Florian Philipp
2013-03-08  4:30 ` Pandu Poluan
2013-03-08  8:23   ` Alan McKinnon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5139A003.6030909@gmail.com \
    --to=alan.mckinnon@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox