ServDoc_0232bind - document a running bind - nameserver
$Id: ServDoc_0232bind,v 1.3 2003/12/02 21:41:41 uherbst Exp $
ServDoc_0232bind [-h|help] [-v|version] [--debug BIND,intensity]
ServDoc_0232bind describes a running bind nameserver: mainly is this version and config files.
The debug feature for that module is named ``BIND''.
Ulrich Herbst <Ulrich.Herbst@gmx.de>
#!/usr/bin/perl -w
#---------------------------------------------------------------------- # standard perl modules use strict; # print error about unknown variables ... use English; # long internal variable names; use FindBin; # In which directory is ServDoc itself ? # There has to be the module and the lib dir! use lib $FindBin::Bin. "/lib"; # Here are the ServDoc-perl-modules use vars qw($options); # our own perl modules use ServDoc; #---------------------------------------------------------------------- $options->{Version} = '$Id: ServDoc_0232bind,v 1.3 2003/12/02 21:41:41 uherbst Exp $'; # We need the cmdline to call the modules with the same debug options. $options->{cmdline} = join " ", @ARGV; sub debug { ServDoc_debug( "BIND", $options, shift, shift ); } $options = &process_cmdline($options); debug( 9, i18n_std('running',$0)); my $h = 'Net%%+Services%%+Bind%%+'; %{$options->{lang}->{en}}= ( version => $h . 'Version', version_short => i18n_std('cmd','named -v'), version_long => '', config => $h . 'Configuration', config_short => i18n_std('file','/etc/named.conf'), config_long => '', ); $h = 'Netzwerk%%+Dienste%%+Bind%%+'; %{$options->{lang}->{de}}= ( version => $h . 'Version', version_short => i18n_std('cmd','named -v'), version_long => '', config => $h . 'Konfiguration', config_short => i18n_std('file','/etc/named.conf'), config_long => '', ); #---------------------------------------------------------------------- # Main # Here is your useful code. my $file; # check if we have bind running my @httpd = ps_grep ("named"); exit 0 if ($#httpd < 0); my @extradirs = ("/usr/local/named/*bin","/usr/local/bind*/*bin"); my $fullcmd = find_path("named",@extradirs); if (!defined($fullcmd)) { debug(8,"We can't find the 'named'- executable"); exit } report_i18n('cmd','version',"$fullcmd -v"); report_i18n('file','config',"/etc/named.conf");