Cover V10, I09

Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Listing 1
Listing 2
Listing 3
Listing 4
Sidebar 1
Sidebar 2
Sidebar 3
Table 1
Table 2
Table 3
Table 4

sep2001.tar


Listing 4 Miles df report

#!/usr/bin/perl
#
# Name: Miles DF report (mi_df)
#
# Purpose: fancy df display
#
# Date: Jan 2001
#
# Required Parameters:
# -------------------------------------------------------------------------
# None.
#
# Optional Parameters:
# -------------------------------------------------------------------------
# None.
#
# Change History:
#
# Date          Name            Comments
# _________________________________________________________________________
#

$FILE="/tmp/df.$$";
`/usr/bin/df -k >$FILE`;
$COLUMNS=`stty -a | grep columns | cut -c 27-29`;
print "=" x $COLUMNS . "\n";

open (DF, $FILE);
while (defined ($_ = <DF> )){
   ($FS, $BLOCKS, $FSFREE, $FSUSED, $IUSED, $PIUSED, $MOUNT) = split;
   $BLOCKS=~s/1024-blocks/Size (Mb)/;
   $FSFREE=~s/Free/Free (Mb)/;
   $FSUSED=~s/([0-9])\%/$1/;
   $PIUSED=~s/([0-9])\%/$1/;

   # note that I switch FS and MOUNT around
   $MOUNT=~s/Mounted/Filesystem/;
   $FS=~s/Filesystem/Other/;

   if ($MOUNT eq "\/") {
      $FS = "Root"
   }
   elsif ($FS=~/:/) {
      $FS1 = "NFS from " . $FS; $FS=$FS1
   }
   else {
      $FS=$MOUNT;
      $FS =~ s/\///;
   }

   if ($BLOCKS ne "Size (Mb)") { $BLOCKS /= 1024 };
   if ($FSFREE ne "Free (Mb)") { $FSFREE = int ($FSFREE /= 1024) };
  if ($MOUNT=~"Filesystem") {
      printf "%-25s %-9s %-9s %-9s %-9s %-11s\n",$MOUNT, $BLOCKS, $FSFREE, \
        $FSUSED, $PIUSED, $FS;
      print "=" x $COLUMNS . "\n" }
   elsif (not $MOUNT=~"\/u\/" or $FS=~"NFS") {
      printf "%-25s %-9d %-9d %-9s %-9s %-11s\n",$MOUNT, $BLOCKS, $FSFREE, \
        $FSUSED, $PIUSED, $FS;
   }
}

print "-" x $COLUMNS . "\n";
close (DF);