zone-ls.pl
branchhs12
changeset 41 3c10c45c6a59
parent 39 8b46e7c48995
child 44 8b487ebf8d99
--- a/zone-ls.pl	Tue Dec 21 13:55:01 2010 +0100
+++ b/zone-ls.pl	Tue Dec 21 14:01:08 2010 +0100
@@ -6,14 +6,14 @@
 use FindBin;
 
 # liest die Konfiguration ein
-my @configs = ( "$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf" );
+my @configs = ("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf");
 my %config;
 
-for ( grep {-f} @configs ) {
-    open( CONFIG, $_ ) or die "Can't open $_: $!\n";
+for (grep { -f } @configs) {
+    open(CONFIG, $_) or die "Can't open $_: $!\n";
 }
 
-unless ( seek( CONFIG, 0, 0 ) ) {
+unless (seek(CONFIG, 0, 0)) {
     die "Can't open config (searched: @configs)\n";
 }
 
@@ -23,23 +23,23 @@
     s/\t//g;
     s/\s//g;
     next unless length;
-    my ( $cname, $ccont ) = split( /\s*=\s*/, $_, 2 );
+    my ($cname, $ccont) = split(/\s*=\s*/, $_, 2);
     $config{$cname} = $ccont;
 }
 close(CONFIG);
 
 my $master_dir = $config{master_dir};
 my $zone;
-my ( $info_zsk, $info_ksk, $info_kc, $info_end, $info_status );
+my ($info_zsk, $info_ksk, $info_kc, $info_end, $info_status);
 
-unless ( -d $master_dir and -r $master_dir ) {
+unless (-d $master_dir and -r $master_dir) {
     die "$master_dir: $!\n";
 }
 
 printf "%-35s %-8s %1s/%1s %3s %7s\n", "Domain", "Status", "ZSK", "KSK",
-    "Used", "Sig-end";
+  "Used", "Sig-end";
 
-for my $dir ( glob "$master_dir/*" ) {
+for my $dir (glob "$master_dir/*") {
 
     $zone = basename($dir);
 
@@ -52,7 +52,7 @@
         }
     }
 
-    if ( not -f "$dir/.index.zsk" ) {
+    if (not -f "$dir/.index.zsk") {
         $info_zsk = $info_ksk = $info_kc = 0;
         $info_end = "-";
         next;
@@ -60,30 +60,30 @@
 
     # prueft wie viele zsks genutzt werden
     close(FILE);
-    open( FILE, $_ = "<$dir/.index.zsk" ) or die "Can't open $_: $!\n";
+    open(FILE, $_ = "<$dir/.index.zsk") or die "Can't open $_: $!\n";
     () = <FILE>;
     $info_zsk = $.;
 
     # prueft wie viele ksks genutzt werden
     close(FILE);
-    open( FILE, $_ = "<$dir/.index.ksk" ) or die "Can't open $_: $!\n";
+    open(FILE, $_ = "<$dir/.index.ksk") or die "Can't open $_: $!\n";
     () = <FILE>;
     $info_ksk = $.;
 
     # prueft wie oft die schluessel zum signieren genutzt wurden
-    open( FILE, $_ = "<$dir/.keycounter" ) or die "Can't open $_: $!\n";
-    chomp( $info_kc = <FILE> );
+    open(FILE, $_ = "<$dir/.keycounter") or die "Can't open $_: $!\n";
+    chomp($info_kc = <FILE>);
 
     # prueft das ablaufdatum
-    if ( !-f "$dir/$zone.signed" ) {
+    if (!-f "$dir/$zone.signed") {
         $info_end = "-";
         next;
     }
 
-    open( FILE, $_ = "<$dir/$zone.signed" ) or die "Can't open $_: $!\n";
+    open(FILE, $_ = "<$dir/$zone.signed") or die "Can't open $_: $!\n";
     while (<FILE>) {
         $info_end = "$+{day}.$+{mon}.$+{year} $+{hour}:$+{min}"
-            if /RSIG.*SOA.*\s
+          if /RSIG.*SOA.*\s
 			(?<year>\d\d\d\d)
 			(?<mon>\d\d)
 			(?<day>\d\d)
@@ -94,7 +94,7 @@
 }
 continue {
     printf "%-35s %-8s %1d/%1d %5d %19s\n", $zone, $info_status, $info_zsk,
-        $info_ksk, $info_kc,
-        $info_end;
+      $info_ksk, $info_kc,
+      $info_end;
 }