checkzone from stdin?

Anand Buddhdev anandb at
Wed Apr 8 19:55:22 UTC 2020

On 08/04/2020 20:58, Matthew Pounsett wrote:

> It looks to me like named-checkzone isn't able to read a zone file from
> stdin.
> % cat | named-checkzone -
> zone loading from master file - failed: file not found
> zone not loaded due to errors.

Hi Matt,

named-checkzone wants a file, so give it a "file":

named-checkzone /dev/stdin <

Note that it would work with "cat file | ..." but I absolutely hate the
cat-pipe combination. I've been known to mark down interviewees who
offer a solution that involves cats and pipes :)

If you want to feed a compressed zone file, then of course a gzcat-pipe
combination will work, eg:

gzcat | named-checkzone /dev/stdin

Finally, if you're running your scripts under bash, then bash offers a
very neat feature:

named-checkzone <(gzcat

The "<(...)" construct in bash runs the command inside the parantheses,
and sends its output to an ephemeral file of the form /dev/fd/42. So the
above command becomes:

named-checkzone /dev/fd/42

and named-checkzone reads the "file" /dev/fd/42, getting the
decompressed data.

Anand Buddhdev

More information about the bind-users mailing list