1 #!/afs/athena/contrib/perl/perl
3 require "/moira/bin/afs_utils.pl";
6 # Nightly reaper - Recompute all usages/allocations.
9 local ($key, @vos, %used,%alloc,%total, %a);
10 local ($c,$as,$ap,$total,$used,$alloc);
15 if (open(TMP,"/afs/athena.mit.edu/service/afs_data")) {
24 ($c,$as,$ap,$t,$total,$used,$alloc) = split(/\s+/,$_);
25 ($as) = gethostbyname($as);
28 $ap =~ s:^([^/]):/vicep\1:;
31 print SRV "$_\n"; next;
35 $total{$key} = $used{$key} = $alloc{$key} = 0;
38 open(VOS,"$vos partinfo $as $ap -cell $c -noauth|");
42 @vos = split(/\s+/,$vos[0]);
43 $total{$key} = pop(@vos);
44 $used{$key} = $total{$key}-$vos[5];
46 open(VOS,"$vos listvol $as $ap -cell $c -long -noauth|");
51 while ($_ = shift(@vos)) {
52 next unless /On-line/;
53 local($vn,$id) = split(/\s+/, $_);
55 local($p,$p,$p) = split(/\s+/, shift(@vos));
56 local($q,$q,$q) = split(/\s+/, shift(@vos));
57 if ($id==$p || !$a{$p}) {
61 for $p (keys %a) { $alloc{$key} += $a{$p}; delete $a{$p}; }
64 for (sort keys %total) {
65 print SRV "$_ $type{$_} $total{$_} $used{$_} $alloc{$_}\n";