#!/bin/ksh # ##### ##### Written by Paul A. Luzzi on 02-01-2002 ##### ##### version 1 written 02-01-2002 ##### version 1.1 updated 07-12-2002 to handle proper sorting ##### version 1.2 updated 08-21-2002 to handle proper spacing ##### version 1.3 updated 08-23-2002 to handle k bytes and multi OS ##### version 1.4 updated 03-24-2008 to handle new linux OS ##### "Red Hat Enterprise Linux AS release 4 (Nahant Update 5)" ##### also renamed (linked) to new "df_multi_line.sh" script ##### ##### Script name : $BBHOME/ext/df_multi_line.sh ##### ##### Small extension script written originally for HP-UX to allow the ##### the df output to all come out on one line per filesystem ##### instead of the HP specific "two line" for long f/s names. ##### Now its also used on RedHat LInux AS4-U5 ##### ######################################################################################## ##### ##### Version 1.3 and earlier used bbsys.local's new variable called DFPROPER, ##### and the bbsys.sh file MUST have its DF entry commented out. ##### Example lines from configured bbsys.local are as follows : ##### ##### DF="$BBHOME/ext/df_multi_line.sh" ##### export DF ##### ##### Version 1.4 and later use Linux instead and take advantage of bb1.5a (and later) ##### built-in edit, which allows DFCMD to override DF. This is what we wanted all ##### along, but had to build our own. ##### ##### ##### ##### ##### For multi-line df output ##### ##### ##### DFCMD="$BBHOME/ext/df_multi_line.sh" ##### DFPROPER="/bin/df " ##### export DFCMD DFPROPER ##### ######################################################################################## ##### ##### To test from command line, run the following : ##### ##### export BBHOME=/usr/local/bb/bb15a $ (on linux) ##### export BBHOME=/usr/local/bb $ (on hp-ux) ##### . $BBHOME/etc/bbdef.sh ##### ##### ##### ##### Do a quick OS check ##### OS_TYPE=`$UNAME -s` ##### ##### Now set $DF options based on OS type ##### case "$OS_TYPE" in HP-UX ) DFPROPER="/usr/bin/df " DFOPTS=" -Pkl " export DFPROPER DFOPTS ;; SunOS ) DFPROPER="/usr/sbin/df " DFOPTS=" -kl " export DFPROPER DFOPTS ;; Linux ) DFPROPER="/bin/df " DFOPTS=" -kl " export DFPROPER DFOPTS ;; * ) DFPROPER="/usr/bin/df " DFOPTS=" -kl " export DFPROPER DFOPTS ;; esac ##### ##### Now run the one line disk checker ##### for device in ` $DFPROPER $DFOPTS | $GREP -v Filesystem | $AWK '$1 ~ /\// {print $1}'` do printf "$device " $DFPROPER $DFOPTS $device | $TAIL -1 | $AWK ' $1 ~ /^[0-9].[0-9]/ {print $1,"\t",$2,"\t",$3,"\t",$4,"\t",$5} $1 ~ /\// {print "\t"$2,"\t",$3,"\t",$4,"\t",$5,"\t",$6}' done | $SORT -n -k $DFSORT ##### ##### End of df_multi_line.sh #####