Simple but very useful:
#-------------------------------
# Validation for 5GB free space.
#-------------------------------
#AIX OS
if [ `uname` = "AIX" ]
then
if [ `df -g $op_path | awk ' { print $2 } ' | tail -1` -lt 5 ]
then
echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
exit
fi
fi
#HP-UX
if [ `uname` = "HP-UX" ]
then
val=`bdf $op_path | awk ' { print $4 } ' | tail -1`
val_gb1=`echo "scale=2; $val/1024" | bc`
val_gb=`echo "scale=2; $val_gb1/1024" | bc`
#if [ $val_gb \< 5 ]
if [ $val_gb -lt 5 ]
then
echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
exit
fi
fi
#SunOS
if [ `uname` = "SunOS" ]
then
val=`df -k $op_path | awk ' { print $4 } ' | tail -1`
val_gb1=`echo "scale=2; $val/1024" | bc`
val_gb=`echo "scale=2; $val_gb1/1024" | bc`
#if [ $val_gb \< 5 ]
if [ $val_gb -lt 5 ]
then
echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
exit
fi
fi
#Linux
if [ `uname` = "Linux" ]
then
val=`df -k $op_path | awk ' { print $4 } ' | tail -1`
val_gb1=`echo "scale=2; $val/1024" | bc`
val_gb=`echo "scale=2; $val_gb1/1024" | bc`
if [ $val_gb \< 5 ]
then
echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
exit
fi
fi
Monday, May 7, 2012
validation for 5GB free space in shell for all platforms
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment