Skip to content

Commit 9cd0fa5

Browse files
authored
Merge pull request hestiacp#1141 from hestiacp/fix/1115_backup-space-check
Add a free disk space validation during backup routine.
2 parents d43ab38 + 72acd7f commit 9cd0fa5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ All notable changes to this project will be documented in this file.
3030
- Fixed an issue with Restore Failed on Domains with Mail Setups using SSL (#1069)
3131
- Fixed an issue with PHPMyAdmin button (#1078)
3232
- Changed WordPress name in Webapp installer (#1074)
33+
- Add a free disk space validation during backup routine (#1115)
34+
3335

3436
## [1.2.3] - Service Release
3537
### Features

bin/v-backup-user

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ start_time=$(date '+%s')
5555
subj="$user → backup failed"
5656
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
5757

58+
# Validate available disk space (take usage * 2, due to the backup handling)
59+
let u_disk=$(grep "U_DISK=" $HESTIA/data/users/$user/user.conf |cut -f 2 -d \')*2
60+
let v_disk=$(($(stat -f --format="%a*%S" $BACKUP)))/1024/1024
61+
62+
if [ "$u_disk" -gt "$v_disk" ]; then
63+
echo "not enough diskspace available to perform the backup." |$SENDMAIL -s "$subj" $email $notify
64+
check_result $E_LIMIT "not enough diskspace available to perform the backup."
65+
fi
66+
5867
if [ -z "$BACKUP_TEMP" ]; then
5968
BACKUP_TEMP=$BACKUP
6069
fi

0 commit comments

Comments
 (0)