V-backup-user admin outputs an error

Hi!

I have a two mail domains without any accounts in HestiaCP 1.9.2.
I make a backup with “sudo /usr/local/hestia/bin/v-backup-user admin” (under “admin” user in Debian 11.11) and see:

-- MAIL --
2025-02-17 02:07:06 domain1.com
tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2025-02-17 02:07:06 domain2.net
tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2025-02-17 02:07:06 *** 2 domains ***

So I have a broken “mail/domain/accounts.tar.gz” in result.

In Debian 12.9:

-- MAIL --
2025-02-17 02:23:57 domain.com
grep: warning: * at start of expression
tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2025-02-17 02:23:57 *** 1 domain ***

I put a few new echo in script “/usr/local/hestia/bin/v-backup-user”:

		# Backup emails
		cd $HOMEDIR/$user/mail/$domain_idn
		accounts=()
		for account in *; do
			exclusion=$(echo "$MAIL" | tr ',' '\n' | grep "$domain:")
echo "$exclusion"
			exclusion=$(echo "$exclusion" | tr ':' '\n' | grep -E "^$account|\*")
echo "$exclusion"

			# Checking exclusions
			if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then
				accounts+=($account)
echo "$account"
			else
				echo "$(date "+%F %T") excluding mail account $account" \
					| tee -a $BACKUP/$user.log
			fi
		done

and see in Debian 11.11:

-- MAIL --
2025-02-17 02:07:06 domain1.com

*
tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2025-02-17 02:07:06 domain2.net

*
tar: *: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
2025-02-17 02:07:06 *** 2 domains ***

How to remove this error from output?

I came up with the solution myself :slight_smile:
It is necessary to check if the “$HOMEDIR/$user/mail/$domain_idn” is empty.
What do you think?