mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
65
bin/v-update-user-disk
Executable file
65
bin/v-update-user-disk
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
# info: update user disk usage
|
||||
# options: user
|
||||
#
|
||||
# The functions recalculates disk usage and updates database.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
user=$1
|
||||
|
||||
# Includes
|
||||
source $VESTA/conf/vesta.conf
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
check_args '1' "$#" 'user'
|
||||
validate_format 'user'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Saving old IFS
|
||||
OLDIFS=$IFS
|
||||
IFS=$(echo -en "\n\b")
|
||||
|
||||
# Defining directory list
|
||||
dir_list=$(ls $HOMEDIR/$user/ |grep -v '^web$' | grep -v '^mail$' |\
|
||||
grep -v '^conf$')
|
||||
|
||||
# Starting update disk loop
|
||||
disk_usage='0'
|
||||
for dir in $dir_list; do
|
||||
dir_disk=$(du -shm "$HOMEDIR/$user/$dir"|cut -f 1 )
|
||||
disk_usage=$((disk_usage + dir_disk))
|
||||
done
|
||||
|
||||
# Restoring old IFS
|
||||
IFS=$OLDIFS
|
||||
|
||||
# Updating disk value in config
|
||||
update_user_value "$user" '$U_DIR_DISK' "$disk_usage"
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Recalculating user disk space
|
||||
recalc_user_disk_usage
|
||||
|
||||
# Logging
|
||||
log_event "$OK" "$EVENT"
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue