fix quota bug

This commit is contained in:
2015-07-10 23:38:35 +03:00
parent fc36b4f18e
commit 28380d8c29

View File

@@ -348,6 +348,11 @@ if [ "$ACTION" == "quota" ]; then
USAGE=$(quota -gsl | tail -n 1 | awk -F" " '{ print $2 }' | sed 's/[A-Za-z]//g')
QUOTA=$(quota -gsl | tail -n 1 | awk -F" " '{ print $3 }' | sed 's/[A-Za-z]//g')
# If smaller than 1M, set usage to 1M to avoid miscalcuations
if [ $(echo $USAGE | grep -q "[A-Za-z]$" ; echo $?) = 0 ]; then
USAGE="1"
fi
PERC=$(echo "scale=2; $USAGE/$QUOTA" | bc)
PERC=$(echo "scale=2; $PERC*100" | bc)