TechRepublic
recently asked members to submit their favorite Network Administration scripts
for possible publication. One of the first to make a submission was Milton
Ingram. For his effort, Milton earned $100 and the satisfaction of seeing his
script published on TechRepublic.


Earn $100 for your admin script

Let us pay
you for your original scripts so that we can publish them as downloads on
TechRepublic and allow your fellow IT professionals to benefit from your
scripting savvy. We only ask that you put in the appropriate comments to your
scripts so that it’s easy to tell what the script is doing and which variables
might need to be customized. Send us your original admin scripts
and we’ll pay you $100 for each one
that we publish as a TechRepublic download.


In their own words

This script
is called df2 (See Listing A).
Please excuse the Win line splits, it provides a more readable list of your Linux
disk usage in Megabytes, which is really handy when you have a RAID attached
with lots of disks. df -k never
really cut it for me. It (df2) uses awk and should work on any UNIX variant. Everyone that sees
it wants a copy. We use it all the time.

Listing A

#!/bin/ksh
# Generate a readable disk free listing
# MWI 0310
#
echo
“=====================================================================

echo “File System Report in MB :” `date`
echo
“=====================================================================

echo “File System Device        Total       Used      Avail   Capacity
Mounted  “
echo
“=====================================================================

df -k | sort -k6 |awk ‘$1!=”swap” && $1!=”Filesystem”
{tt+=$2;tu+=$3;tr+=$4;printf “%-20s
%10.2f %10.2f %10.2f %7s      %-16s\n”, $1, $2/1024, $3/1024, $4/1024, $5,
$6}
END{printf “\nTotal Storage is     %10.2f %10.2f %10.2f\n”, tt/1024,
tu/1024, tr/1024 }’
echo
“=====================================================================