Skip to content

Commit 7e8f09d

Browse files
authored
Update v-backup-user (hestiacp#3228)
1 parent 6f694fd commit 7e8f09d

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

bin/v-backup-user

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ get_user_disk_usage() {
5454
| awk -F "DOMAIN='" '{print $2}' | cut -f 1 -d \')
5555

5656
for domain in $domains; do
57-
exclusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain$")
57+
exclusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain\|\*$")
5858
if [ -z "$exclusion" ]; then
5959
# Defining home directory
6060
home_dir="$HOMEDIR/$user/web/$domain/"
61-
exlusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain:")
61+
exclusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain\|\*:")
6262
fargs=()
6363

64-
if [ -n "$exlusion" ]; then
65-
xdirs=$(echo -e "$exlusion" | tr ':' '\n' | grep -v "$domain")
64+
if [ -n "$exclusion" ]; then
65+
xdirs=$(echo -e "$exclusion" | tr ':' '\n' | grep -v "$domain\|\*")
6666
for xpath in $xdirs; do
6767
fargs+=(--exclude="$xpath")
6868
done
@@ -245,7 +245,7 @@ if [ -n "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
245245
# Parsing domain exclusions
246246
conf="$USER_DATA/web.conf"
247247
for domain in $(search_objects 'web' 'SUSPENDED' "*" 'DOMAIN'); do
248-
exclusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain$")
248+
exclusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain\|\*$")
249249
if [ -z "$exclusion" ]; then
250250
web_list="$web_list $domain"
251251
else
@@ -361,12 +361,17 @@ if [ -n "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
361361
cd $HOMEDIR/$user/web/$domain
362362

363363
# Define exclude arguments
364-
exlusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain:")
364+
exclusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain\|\*:")
365365
set -f
366366
fargs=()
367367
fargs+=(--exclude='./logs/*')
368-
if [ -n "$exlusion" ]; then
369-
xdirs="$(echo -e "$exlusion" | tr ':' '\n' | grep -v $domain)"
368+
if [ -n "$exclusion" ]; then
369+
370+
if [[ "$exclusion" =~ '*' ]]; then
371+
exclusion="${exclusion/\*/$domain}"
372+
fi
373+
374+
xdirs="$(echo -e "$exclusion" | tr ':' '\n' | grep -v $domain)"
370375
for xpath in $xdirs; do
371376
if [ -d "$xpath" ]; then
372377
fargs+=(--exclude=$xpath/*)
@@ -498,7 +503,7 @@ if [ -n "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
498503
exclusion=$(echo "$MAIL" | tr ',' '\n' | grep "$domain:")
499504
exclusion=$(echo "$exclusion" | tr ':' '\n' | grep -E "^$account|\*")
500505

501-
# Checking exlusions
506+
# Checking exclusions
502507
if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then
503508
accounts+=($account)
504509
else
@@ -634,7 +639,7 @@ if [ "$USER" != '*' ]; then
634639
mkdir $tmpdir/user_dir
635640
cd $HOMEDIR/$user
636641

637-
# Parsing directory exlusions
642+
# Parsing directory exclusions
638643
USER=''
639644
if [ -e "$USER_DATA/backup-excludes.conf" ]; then
640645
source $USER_DATA/backup-excludes.conf

0 commit comments

Comments
 (0)