Andy 3 лет назад
Родитель
Сommit
7e8f09d692
1 измененных файлов с 15 добавлено и 10 удалено
  1. 15 10
      bin/v-backup-user

+ 15 - 10
bin/v-backup-user

@@ -54,15 +54,15 @@ get_user_disk_usage() {
 			| awk -F "DOMAIN='" '{print $2}' | cut -f 1 -d \')
 			| awk -F "DOMAIN='" '{print $2}' | cut -f 1 -d \')
 
 
 		for domain in $domains; do
 		for domain in $domains; do
-			exclusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain$")
+			exclusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain\|\*$")
 			if [ -z "$exclusion" ]; then
 			if [ -z "$exclusion" ]; then
 				# Defining home directory
 				# Defining home directory
 				home_dir="$HOMEDIR/$user/web/$domain/"
 				home_dir="$HOMEDIR/$user/web/$domain/"
-				exlusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain:")
+				exclusion=$(echo -e "$web_exclusions" | tr ',' '\n' | grep "^$domain\|\*:")
 				fargs=()
 				fargs=()
 
 
-				if [ -n "$exlusion" ]; then
-					xdirs=$(echo -e "$exlusion" | tr ':' '\n' | grep -v "$domain")
+				if [ -n "$exclusion" ]; then
+					xdirs=$(echo -e "$exclusion" | tr ':' '\n' | grep -v "$domain\|\*")
 					for xpath in $xdirs; do
 					for xpath in $xdirs; do
 						fargs+=(--exclude="$xpath")
 						fargs+=(--exclude="$xpath")
 					done
 					done
@@ -245,7 +245,7 @@ if [ -n "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
 	# Parsing domain exclusions
 	# Parsing domain exclusions
 	conf="$USER_DATA/web.conf"
 	conf="$USER_DATA/web.conf"
 	for domain in $(search_objects 'web' 'SUSPENDED' "*" 'DOMAIN'); do
 	for domain in $(search_objects 'web' 'SUSPENDED' "*" 'DOMAIN'); do
-		exclusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain$")
+		exclusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain\|\*$")
 		if [ -z "$exclusion" ]; then
 		if [ -z "$exclusion" ]; then
 			web_list="$web_list $domain"
 			web_list="$web_list $domain"
 		else
 		else
@@ -361,12 +361,17 @@ if [ -n "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
 		cd $HOMEDIR/$user/web/$domain
 		cd $HOMEDIR/$user/web/$domain
 
 
 		# Define exclude arguments
 		# Define exclude arguments
-		exlusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain:")
+		exclusion=$(echo -e "$WEB" | tr ',' '\n' | grep "^$domain\|\*:")
 		set -f
 		set -f
 		fargs=()
 		fargs=()
 		fargs+=(--exclude='./logs/*')
 		fargs+=(--exclude='./logs/*')
-		if [ -n "$exlusion" ]; then
-			xdirs="$(echo -e "$exlusion" | tr ':' '\n' | grep -v $domain)"
+		if [ -n "$exclusion" ]; then
+
+			if [[ "$exclusion" =~ '*' ]]; then
+				exclusion="${exclusion/\*/$domain}"
+			fi
+
+			xdirs="$(echo -e "$exclusion" | tr ':' '\n' | grep -v $domain)"
 			for xpath in $xdirs; do
 			for xpath in $xdirs; do
 				if [ -d "$xpath" ]; then
 				if [ -d "$xpath" ]; then
 					fargs+=(--exclude=$xpath/*)
 					fargs+=(--exclude=$xpath/*)
@@ -498,7 +503,7 @@ if [ -n "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
 			exclusion=$(echo "$MAIL" | tr ',' '\n' | grep "$domain:")
 			exclusion=$(echo "$MAIL" | tr ',' '\n' | grep "$domain:")
 			exclusion=$(echo "$exclusion" | tr ':' '\n' | grep -E "^$account|\*")
 			exclusion=$(echo "$exclusion" | tr ':' '\n' | grep -E "^$account|\*")
 
 
-			# Checking exlusions
+			# Checking exclusions
 			if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then
 			if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then
 				accounts+=($account)
 				accounts+=($account)
 			else
 			else
@@ -634,7 +639,7 @@ if [ "$USER" != '*' ]; then
 	mkdir $tmpdir/user_dir
 	mkdir $tmpdir/user_dir
 	cd $HOMEDIR/$user
 	cd $HOMEDIR/$user
 
 
-	# Parsing directory exlusions
+	# Parsing directory exclusions
 	USER=''
 	USER=''
 	if [ -e "$USER_DATA/backup-excludes.conf" ]; then
 	if [ -e "$USER_DATA/backup-excludes.conf" ]; then
 		source $USER_DATA/backup-excludes.conf
 		source $USER_DATA/backup-excludes.conf