Subject: | |
From: | |
Reply To: | |
Date: | Thu, 16 Aug 2001 16:31:40 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Not a problem. I pulled it down from the ftp site.
David Knispel
[log in to unmask]
Phone: 513-248-5029
Fax: 513-248-2672
----- Original Message -----
From: "Bill Hassell" <[log in to unmask]>
To: "dave.knispel" <[log in to unmask]>
Sent: Thursday, August 16, 2001 3:50 PM
Subject: Re: [HP9000-L] bdf problem
> Hi,
>
>
> >
> > Bill,
> >
> > Thanks. This is what I needed.
>
> Oops, I forgot to include the script.
>
> --
> Bill Hassell
> Remote Engineering Services
> HP Atlanta Response Center
> email: [log in to unmask]
>
> -------------------------------------------------------------------
>
> #!/usr/bin/sh
> #
> # Ver 1.2 -Expanded filesystem type to handle autofs
> # Ver 1.1 -Added blocksize column for filesystem blocks
> # Ver 1.0 -Original
> #
> # Show bdf in megs for easy reading
> #
> # Usage: bdfmegs
>
> # The width of the source filesystem will be adjusted to the
> # longest path (ie, NFS or other long device filename). All
> # fields are in megabytes (defined as Kbytes/1024). Field
> # widths are 7 digits for multi-terabyte capability.
>
> set -u
>
> # These values are tied to the widths if the fields and the title.
>
> typeset -R7 MTOT
> typeset -R7 MUSED
> typeset -R7 MAVAIL
> typeset -R5 PERCENT
> typeset -R2 BLKSIZE
> typeset -R6 FSTYPE
>
> # Find the longest source string with a sweep through mount -p
> # Minimum length is 12 so typeset will pad on the right when
> # needed.
>
> MAXLEN=12
> /sbin/mount -p | while read SOURCE MOUNTPOINT DUMMY
> do
> [ ${#SOURCE} -gt $MAXLEN ] && MAXLEN=${#SOURCE}
> done
>
> # Variable width typesets here
> #
> # By using eval, a variable typeset instruction can be created
> # and then executed as part of the inline script.
>
> # First is for the filesystem source string
> # Second is to pad the title. Note that PAD must be typeset to
> # a value greater than 0, so subtract 11 for the evaluation.
> # (the minimum width for a source directory is 12 chars)
>
> eval "typeset -L$MAXLEN FS"
> eval "typeset -L$(( MAXLEN - 11 )) PAD=' '"
>
> # Now get all filesystems including filesystem type
> # Separate the mount point from FStype with a :
>
> MYMOUNTS=$(/sbin/mount -p | /usr/bin/awk '{print $2":"$3}')
>
> # Print the title line. $PAD is used to prorvide proper spacing for
> # short to long source filesystem names. This must match the
> # evaluated typeset value for $FS above.
>
> echo "File System $PAD Mbytes Used Avail %Used Type Blk Mounted on"
>
> # Now walk through each mountpoint gathering info
>
> # Because bdf may have a double line when a long filesystem is
> # shown, get a list of mounted filesystems first (just the 2nd
> # field of mount -p) then go through that list 1 at a time to
> # get details and automatically paste the line in case it's
> # longer than normal and therefore folded.
>
> for MNTINFO in $MYMOUNTS
> do
> MOUNTPOINT=$( echo $MNTINFO | cut -f1 -d: )
> FSTYPE=$( echo $MNTINFO | cut -f2 -d: )
> /usr/bin/bdf $MOUNTPOINT 2>/dev/null \
> | grep -vi \%used \
> | paste - - \
> | while read FS TOT USED AVAIL PERCENT MNT
> do
> MTOT=$(echo $TOT \
> | /usr/bin/awk '{print int($1/1024+.5)}')
> MUSED=$(echo $USED \
> | /usr/bin/awk '{print int($1/1024+.5)}')
> MAVAIL=$(echo $AVAIL \
> | /usr/bin/awk '{print int($1/1024+.5)}')
> BLKSIZE=$(/usr/bin/df -g $MNT \
> | /usr/bin/grep "file system block" \
> | /usr/bin/awk '{print $1/1024}')
> echo "$FS $MTOT $MUSED $MAVAIL $PERCENT $FSTYPE ${BLKSIZE}K $MNT"
> done
> done
|
|
|