mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
switched to bc for math calculation
This commit is contained in:
parent
fa4813cf89
commit
062b7e81f0
1 changed files with 4 additions and 4 deletions
|
@ -33,17 +33,17 @@ is_object_valid 'user' 'USER' "$user"
|
||||||
# Updating disk quota
|
# Updating disk quota
|
||||||
# Had quota equals package value. Soft quota equals 90% of package value for warnings.
|
# Had quota equals package value. Soft quota equals 90% of package value for warnings.
|
||||||
quota=$(get_user_value '$DISK_QUOTA')
|
quota=$(get_user_value '$DISK_QUOTA')
|
||||||
soft=$((quota * 1024 * 0.90))
|
soft=$(echo "$quota * 1024 * 0.90"|bc |cut -f 1 -d .)
|
||||||
hard=$((quota * 1024))
|
hard=$(echo "$quota * 1024"|bc |cut -f 1 -d .)
|
||||||
|
|
||||||
# Searching home mount point
|
# Searching home mount point
|
||||||
mnt=$(df -P /home |awk '{print $6}' |tail -n1)
|
mnt=$(df -P /home |awk '{print $6}' |tail -n1)
|
||||||
|
|
||||||
# Checking unlinmited quota
|
# Checking unlinmited quota
|
||||||
if [ "$quota" = 'unlimited' ]; then
|
if [ "$quota" = 'unlimited' ]; then
|
||||||
setquota $user 0 0 0 0 $mnt
|
setquota $user 0 0 0 0 $mnt 2>/dev/null
|
||||||
else
|
else
|
||||||
setquota $user $soft $hard 0 0 $mnt
|
setquota $user $soft $hard 0 0 $mnt 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue