myvesta/bin/v-update-user-quota
2014-06-06 14:42:14 +03:00

50 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# info: update user disk quota
# options: USER
#
# The functions upates disk quota for specific user
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER'
validate_format 'user'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Updating disk quota
soft=$(get_user_value '$DISK_QUOTA')
soft=$((soft * 1000))
hard=$((soft + 50000))
mnt=$(df -P /home |awk '{print $6}' |tail -n1)
setquota $user $soft $hard 0 0 $mnt
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$EVENT"
exit