diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-04-01 17:05:08 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-04-01 17:05:08 +0300 |
commit | a51ba4fa1a4d3e2e868e1028c85145e302a1462d (patch) | |
tree | eedbb0eb3213fdebb7de0a56e7f33988da569ebc | |
parent | 2fd19a6808a9d7b86ad294ae20ad9dcf1c4f6325 (diff) | |
download | dnstools-a51ba4fa1a4d3e2e868e1028c85145e302a1462d.tar.gz dnstools-a51ba4fa1a4d3e2e868e1028c85145e302a1462d.tar.bz2 |
Document nsdbimport
-rwxr-xr-x | nsdbimport/nsdbimport | 176 |
1 files changed, 174 insertions, 2 deletions
diff --git a/nsdbimport/nsdbimport b/nsdbimport/nsdbimport index da6b501..e2969c8 100755 --- a/nsdbimport/nsdbimport +++ b/nsdbimport/nsdbimport | |||
@@ -410,7 +410,7 @@ GetOptions("h" => sub { | |||
410 | pod2usage(-exitstatus => EX_OK, -verbose => 0); | 410 | pod2usage(-exitstatus => EX_OK, -verbose => 0); |
411 | }, | 411 | }, |
412 | "directory|C=s" => \$bind_directory, | 412 | "directory|C=s" => \$bind_directory, |
413 | "from-config=s" => \$bind_config, | 413 | "bind-config|from-config=s" => \$bind_config, |
414 | "origin=s" => \$origin, | 414 | "origin=s" => \$origin, |
415 | "debug|d+" => \$debug, | 415 | "debug|d+" => \$debug, |
416 | "dry-run|n" => \$dry_run, | 416 | "dry-run|n" => \$dry_run, |
@@ -422,7 +422,7 @@ unless (defined($conffile)) { | |||
422 | ($conffile) = grep { -e $_ } ( | 422 | ($conffile) = grep { -e $_ } ( |
423 | '.nsdbimport.conf', | 423 | '.nsdbimport.conf', |
424 | "$ENV{HOME}/.nsdbimport.conf", | 424 | "$ENV{HOME}/.nsdbimport.conf", |
425 | 'etc/.nsdbimport.conf'); | 425 | '/etc/.nsdbimport.conf'); |
426 | } | 426 | } |
427 | 427 | ||
428 | abend(EX_USAGE, "no configuration file; please use the --config option") | 428 | abend(EX_USAGE, "no configuration file; please use the --config option") |
@@ -485,3 +485,175 @@ error('set generate=yes to enable processing of $GENERATE directives') | |||
485 | if ($generate_seen); | 485 | if ($generate_seen); |
486 | 486 | ||
487 | $dbd->disconnect; | 487 | $dbd->disconnect; |
488 | __END__ | ||
489 | =head1 NAME | ||
490 | |||
491 | nsdbimport - import data from BIND-compatible zone files to SQL database | ||
492 | |||
493 | =head1 SYNOPSIS | ||
494 | |||
495 | B<nsdbimport> | ||
496 | [B<-dhn>] | ||
497 | [B<-C> I<DIR>] | ||
498 | [B<-c> I<FILE>] | ||
499 | [B<--bind-config=>I<FILE>] | ||
500 | [B<--config=>I<FILE> | ||
501 | [B<--debug>] | ||
502 | [B<--directory=>I<DIR>] | ||
503 | [B<--dry-run>] | ||
504 | [B<--from-config=>I<FILE>] | ||
505 | [B<--help>] | ||
506 | [B<--origin=>I<ZONE>] | ||
507 | [B<--usage>] | ||
508 | [I<ZONEFILE>...] | ||
509 | |||
510 | =head1 DESCRIPTION | ||
511 | |||
512 | =head1 OPTIONS | ||
513 | |||
514 | =over 4 | ||
515 | |||
516 | =item B<-d>, B<--debug> | ||
517 | |||
518 | Increase debug level. | ||
519 | |||
520 | =item B<-C> I<DIR> | ||
521 | |||
522 | Set current working directory. All zone files specified with relative | ||
523 | file names will be searched in that directory. | ||
524 | |||
525 | =item B<-c>, B<--config=>I<FILE> | ||
526 | |||
527 | Read configuration from I<FILE>. If this option is not given, B<nsdbimport> | ||
528 | tries the following files: F<.nsdbimport.conf>, F<~/.nsdbimport.conf> and | ||
529 | F</etc/.nsdbimport.conf>. First of them which exists is read. See the | ||
530 | section B<CONFIGURATION> below for a discussion of configuration file format. | ||
531 | |||
532 | =item B<--bind-config=>, B<--from-config=>I<FILE> | ||
533 | |||
534 | Parse BIND configuration file I<FILE> and process all files corresponding | ||
535 | to master zones. Note, that this option relies on B<cfpeek>(1) being | ||
536 | installed on your system. | ||
537 | |||
538 | =item B<-n>, B<--dry-run> | ||
539 | |||
540 | Don't actually import data, print what would have been done instead. | ||
541 | |||
542 | =item B<--origin=>I<ZONE> | ||
543 | |||
544 | Set initial origin. Useful when processing individual files. | ||
545 | |||
546 | =back | ||
547 | |||
548 | The following options cause the program to display informative text and | ||
549 | exit: | ||
550 | |||
551 | =over 4 | ||
552 | |||
553 | =item B<-h> | ||
554 | |||
555 | Show a short usage summary. | ||
556 | |||
557 | =item B<--help> | ||
558 | |||
559 | Show man page. | ||
560 | |||
561 | =item B<--usage> | ||
562 | |||
563 | Show a concise command line syntax reminder. | ||
564 | |||
565 | =back | ||
566 | |||
567 | =head1 CONFIGURATION | ||
568 | |||
569 | Configuration file supplies credentials for accessing the database and | ||
570 | templates for the SQL queries (normally, B<INSERT> statements) to be | ||
571 | used in order to import records of particular B<RR> types. | ||
572 | |||
573 | Upon startupe B<nsdbimport> looks for the following files (in that order): | ||
574 | F<.nsdbimport.conf>, F<~/.nsdbimport.conf>, or F</etc/.nsdbimport.conf>. | ||
575 | First of them that exists is read and parsed as a configuration file. | ||
576 | |||
577 | If the command line option B<--config> (B<-c>) is given, its value is | ||
578 | taken as the name of the configuration file to read. In that case, | ||
579 | default configuration files are not scanned. | ||
580 | |||
581 | Configuration consists of I<keyword>=I<value> pairs. Any amount of white | ||
582 | space is allowed on either side of the equals sign. Each pair occupies | ||
583 | a single logical line. To split very long lines, the usual backslash | ||
584 | escaping is used: any line ending with a backslash immediately followed | ||
585 | by a newline indicates continuation on the next line. The newline character | ||
586 | is stripped off and the contents of the next line is appended in its place. | ||
587 | |||
588 | Comments begin with B<#> character and extend to the end of physical line. | ||
589 | |||
590 | Empty lines are ignored. | ||
591 | |||
592 | The following statements configure database credentials | ||
593 | |||
594 | =over 4 | ||
595 | |||
596 | =item B<database=>I<STRING> | ||
597 | |||
598 | Database name. | ||
599 | |||
600 | =item B<host=>I<NAME> | ||
601 | |||
602 | Hostname or IP address of the host running the database server. | ||
603 | |||
604 | =item B<port=>I<NUM> | ||
605 | |||
606 | Port number, if differs from the default. | ||
607 | |||
608 | =item B<db-params=>I<STRING> | ||
609 | |||
610 | Additional options. | ||
611 | |||
612 | =item B<user=>I<STRING> | ||
613 | |||
614 | Database user name. | ||
615 | |||
616 | =item B<password=>I<STRING> | ||
617 | |||
618 | Password to connect to the database. | ||
619 | |||
620 | =item B<db-default-file=>I<FILE> | ||
621 | |||
622 | Pathname of the mysql defaults (a.k.a. options) file to use. The utility | ||
623 | will look for the section B<[client]> and use options defined in it. The | ||
624 | use of mysql defaults file is advised, instead of specifying database | ||
625 | credentials in B<nsdbimport> configuration file. | ||
626 | |||
627 | =back | ||
628 | |||
629 | The following two options control how the import is performed, in general. | ||
630 | |||
631 | =over 4 | ||
632 | |||
633 | =item B<generate=>I<no>|I<yes> | ||
634 | |||
635 | Enable or disable processing of B<$GENERATE> directives. Such directives | ||
636 | usually insert enormous amount of data into the database and therefore | ||
637 | are disabled by default. Set B<generate = yes> to enable them. | ||
638 | |||
639 | =item B<rr-query=>I<TEMPLATE> | ||
640 | |||
641 | A generic query which inserts a single B<RR> record in the database. It | ||
642 | will be used whenever a record is imported that has no special query | ||
643 | statement defined for its B<RR> type. | ||
644 | |||
645 | =back | ||
646 | |||
647 | =head1 BUGS | ||
648 | |||
649 | Only MySQL is supported. | ||
650 | |||
651 | =head1 SEE ALSO | ||
652 | |||
653 | B<cfpeek>(1), B<named>(8), B<named.conf>(5). | ||
654 | |||
655 | =head1 AUTHOR | ||
656 | |||
657 | Sergey Poznyakoff <gray@gnu.org> | ||
658 | |||
659 | =cut | ||