mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Checking necessary available disk space before doing backup
Many thanks to @ScIT-Raphael and HestiaCP https://github.com/hestiacp/hestiacp/pull/1141
This commit is contained in:
parent
147e75412f
commit
fd47112fc1
1 changed files with 9 additions and 0 deletions
|
@ -54,6 +54,15 @@ start_time=$(date '+%s')
|
|||
subj="$user → backup failed"
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf |cut -f 2 -d \')
|
||||
|
||||
# Validate available disk space (take usage * 2, due to the backup handling)
|
||||
let u_disk=$(grep "U_DISK=" $VESTA/data/users/$user/user.conf |cut -f 2 -d \')*2
|
||||
let v_disk=$(($(stat -f --format="%a*%S" $BACKUP)))/1024/1024
|
||||
|
||||
if [ "$u_disk" -gt "$v_disk" ]; then
|
||||
echo "not enough diskspace available to perform the backup." |$SENDMAIL -s "$subj" $email $notify
|
||||
check_result $E_LIMIT "not enough diskspace available to perform the backup."
|
||||
fi
|
||||
|
||||
if [ -z "$BACKUP_TEMP" ]; then
|
||||
BACKUP_TEMP=$BACKUP
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue