Linux Unix help !!

"Give respect to Time, One day at right Time, Time will respect You"

Friday, September 20, 2013

Script to print partition utilization - HP-UX

In HP-UX admin always want to have disk utilization output in Linux native format as "df- h"

Here the small script which format and give bdf output as "df -h"

In HP-UX, the bdf command display partition details in KB, so here's script that will display partition details in MB .

# vi bdff

################################
# Shirish Shukla
# Script to print partition utilization
################################
# Script to print Disk UTIL
if [ -z "$1" ]
then
df -Pk |egrep -v "Filesystem" | awk 'BEGIN { print "  -Filesystem-\t\t -Total(MB)-\t-used(MB)-\t-avail(MB)-   -%used-\t-Mounted on-"}  {print "  " $1 "   \t " $2/1024 " \t" $3/1024 "    \t" $4/1024 "  \t" $5 "  \t" $6 }'
else
   a=$1
df -Pk |egrep -v "Filesystem" | awk 'BEGIN { print "  -Filesystem-\t\t -Total(MB)-\t-used(MB)-\t-avail(MB)-   -%used-\t-Mounted on-"}  {print "  " $1 "   \t " $2/1024 " \t" $3/1024 "   \t" $4/1024 "  \t" $5 "  \t" $6 }' | egrep -i "filesystem|$a"
fi


# chmod 755 bdff 
# mv  bdff   /usr/bin/bdff

# bdff

No comments:

Post a Comment

Write Here .. your comments are always wellcome ..but no spam please !!

Followers

Pls LIKE my Story !!!