Skip to content

Commit 062b7e8

Browse files
committed
switched to bc for math calculation
1 parent fa4813c commit 062b7e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/v-update-user-quota

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ is_object_valid 'user' 'USER' "$user"
3333
# Updating disk quota
3434
# Had quota equals package value. Soft quota equals 90% of package value for warnings.
3535
quota=$(get_user_value '$DISK_QUOTA')
36-
soft=$((quota * 1024 * 0.90))
37-
hard=$((quota * 1024))
36+
soft=$(echo "$quota * 1024 * 0.90"|bc |cut -f 1 -d .)
37+
hard=$(echo "$quota * 1024"|bc |cut -f 1 -d .)
3838

3939
# Searching home mount point
4040
mnt=$(df -P /home |awk '{print $6}' |tail -n1)
4141

4242
# Checking unlinmited quota
4343
if [ "$quota" = 'unlimited' ]; then
44-
setquota $user 0 0 0 0 $mnt
44+
setquota $user 0 0 0 0 $mnt 2>/dev/null
4545
else
46-
setquota $user $soft $hard 0 0 $mnt
46+
setquota $user $soft $hard 0 0 $mnt 2>/dev/null
4747
fi
4848

4949

0 commit comments

Comments
 (0)