[Dnsmasq-discuss] Can use sub-directories in addn-hosts?

Simon Kelley simon at thekelleys.org.uk
Thu Oct 18 07:30:19 BST 2012


On 17/10/12 22:46, David Rosenstrauch wrote:
> I've been successfully using a directory of files in conjunction with
> the --addn-hosts parameter.  (Dnsmasq successfully reads all files in
> the directory.)  Very useful feature!
>
> However, for my application it would be extremely useful if dnsmasq were
> able to use subdirectories of the --addn-hosts dir - i.e., if it could
> read all files in any subdirectory of the --addn-hosts dir.
>
> Is it possible to do this - or somehow simulate this - with dnsmasq?
>
> Note that for my application, it wouldn't be sufficient to just specify
> each subdirectory as a separate --addn-hosts dir at run time - the
> subdirectories would be created and deleted dynamically after dnsmasq
> starts.  (The intent is that I would issue a SIGHUP to the dnsmasq
> process and have it read any new subdirectories, and process any files
> within it.)

 From the man page for the current version of dnsmasq: If yours doesn't 
say this, you may have to upgrade: I can't find the exact version at 
which the directory-reading facility was added, but it was fairly long ago.

-H, --addn-hosts=<file>
    Additional hosts file.  Read  the  specified  file  as  well  as
    /etc/hosts.  If  -h is given, read only the specified file. This
    option may be repeated for more than one additional hosts  file.
    If  a  directory  is given, then read all the files contained in
    that directory.

Cheers,

Simon




More information about the Dnsmasq-discuss mailing list