Skip to content

Commit 35c2b2c

Browse files
committed
Add a free disk space validation during backup routine.
This commit fixes hestiacp#1115
1 parent 5298776 commit 35c2b2c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
1111
- Upgrade process will now save logs to the `hst_backups` directory.
1212

1313
## Bugfixes
14+
- Add a free disk space validation during backup routine.
1415

1516
## [1.2.3] - Service Release
1617
### 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)