From 062b7e81f050dfe229ed994033a71300964fd622 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Wed, 28 Oct 2015 16:33:55 +0200 Subject: [PATCH] switched to bc for math calculation --- bin/v-update-user-quota | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/v-update-user-quota b/bin/v-update-user-quota index 3dffb1220..754639b71 100755 --- a/bin/v-update-user-quota +++ b/bin/v-update-user-quota @@ -33,17 +33,17 @@ is_object_valid 'user' 'USER' "$user" # Updating disk quota # Had quota equals package value. Soft quota equals 90% of package value for warnings. quota=$(get_user_value '$DISK_QUOTA') -soft=$((quota * 1024 * 0.90)) -hard=$((quota * 1024)) +soft=$(echo "$quota * 1024 * 0.90"|bc |cut -f 1 -d .) +hard=$(echo "$quota * 1024"|bc |cut -f 1 -d .) # Searching home mount point mnt=$(df -P /home |awk '{print $6}' |tail -n1) # Checking unlinmited quota if [ "$quota" = 'unlimited' ]; then - setquota $user 0 0 0 0 $mnt + setquota $user 0 0 0 0 $mnt 2>/dev/null else - setquota $user $soft $hard 0 0 $mnt + setquota $user $soft $hard 0 0 $mnt 2>/dev/null fi