fix bug which always resulted in quota usage of 1MB
This commit is contained in:
@@ -346,12 +346,14 @@ if [ "$ACTION" == "quota" ]; then
|
||||
echo "Calculating account disk usage..."
|
||||
echo
|
||||
|
||||
USAGE=$(quota -gsl | tail -n 1 | awk -F" " '{ print $2 }' | sed 's/[A-Za-z]//g')
|
||||
USAGE=$(quota -gsl | tail -n 1 | awk -F" " '{ print $2 }')
|
||||
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"
|
||||
else
|
||||
USAGE=$(echo $USAGE | sed 's/[A-Za-z]//g')
|
||||
fi
|
||||
|
||||
PERC=$(echo "scale=2; $USAGE/$QUOTA" | bc)
|
||||
|
||||
Reference in New Issue
Block a user