]> andersk Git - moira.git/blobdiff - backup/report.sh
update for users table schema change, and give split a number not an
[moira.git] / backup / report.sh
index e5f9d6ba340ac7d6dc8a96860277de6a107a2f1c..5e91389f15c260f1c65f6c625bb4d0bf2060f646 100644 (file)
@@ -1,7 +1,7 @@
 #!/moira/bin/perl
 # $Header$
 
-chdir($ARGV[1]);
+chdir($ARGV[0]);
 
 ($sec, $min, $hour, $mday, $month) = localtime($^T);
 @MONTHS = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
@@ -28,7 +28,7 @@ print "\n";
 undef %TYPES;
 
 
-open(CLUSTERS, "cluster") || die "Cannot open cluster file for input.\n";
+open(CLUSTERS, "clusters") || die "Cannot open clusters file for input.\n";
 
 $total = 0;
 
@@ -42,17 +42,17 @@ delete $TYPES{"NONE"};
 printf("%5d Clusters\n\n", $total);
 
 
-open(PRINTCAP, "printcap") || die "Cannot open printcap file for input.\n";
+open(PRINTERS, "printers") || die "Cannot open printers file for input.\n";
 
 $total = 0;
 
-while (<PRINTCAP>) {
-    split(/\|/, $_, 7);
-    if ($_[5]) { $auth++;  }
+while (<PRINTERS>) {
+    split(/\|/, $_, 11);
+    if ($_[9]) { $auth++; }
     $total++;
 }
 
-close(PRINTCAP);
+close(PRINTERS);
 
 printf("%5d Printers, %d with authentication (%d%%).\n\n", $total, $auth,
        (100 * $auth + $total/2)/$total);
@@ -65,11 +65,11 @@ $total = 0;
 
 while (<USERS>) {
     s/\|/\e/g; s/\\\e/\|/g;
-    split(/\e/, $_, $27);
-    $total++; $STATUS{$_[7]}++;
-    if ($_[7] != 3) { $classtotal++; $CLASS{$_[9]}++; }
-    if ($_[7] == 1) { $CLASSA{$_[9]}++; }
-    if ($_[7] == 1 || $_[7] == 6) { $pototal++; $POTYPE{$_[25]}++; }
+    split(/\e/, $_, 28);
+    $total++; $STATUS{$_[8]}++;
+    if ($_[8] != 3) { $classtotal++; $CLASS{$_[10]}++; }
+    if ($_[8] == 1) { $CLASSA{$_[10]}++; }
+    if ($_[8] == 1 || $_[8] == 6) { $pototal++; $POTYPE{$_[26]}++; }
 }
 
 close(USERS);
This page took 0.600504 seconds and 4 git commands to generate.