diff --git a/bin/v-backup-user b/bin/v-backup-user index 6749f1c1..e7375176 100755 --- a/bin/v-backup-user +++ b/bin/v-backup-user @@ -205,10 +205,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then # Backup files cd $HOMEDIR/$user/web/$domain - tar -cpf $tmpdir/web/$domain/domain_data.tar * ${fargs[@]} - - # Compress archive - gzip -$BACKUP_GZIP $tmpdir/web/$domain/domain_data.tar + tar -cpf- * ${fargs[@]} |gzip -$BACKUP_GZIP - > $tmpdir/web/$domain/domain_data.tar.gz done # Print total @@ -307,16 +304,14 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then # Backup emails cd $HOMEDIR/$user/mail/$domain_idn + accounts=() for account in $(ls); do exclusion=$(echo "$MAIL" |tr ',' '\n' |grep "$domain:") exclusion=$(echo "$exclusion" |tr ':' '\n' |grep "^$account$") # Checking exlusions if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then - echo "$(date "+%F %T") + $account@$domain" |\ - tee -a $BACKUP/$user.log - touch $tmpdir/mail/$domain/accounts.tar - tar -rpf $tmpdir/mail/$domain/accounts.tar $account + accounts+=($account) else echo "$(date "+%F %T") excluding mail account $account" |\ tee -a $BACKUP/$user.log @@ -324,8 +319,8 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then done # Compress archive - if [ -e "$tmpdir/mail/$domain/accounts.tar" ]; then - gzip -$BACKUP_GZIP $tmpdir/mail/$domain/accounts.tar + if [ ${#accounts[@]} -gt 0 ]; then + tar -cpf- ${accounts[@]} |gzip -$BACKUP_GZIP - > $tmpdir/mail/$domain/accounts.tar.gz fi done @@ -445,10 +440,7 @@ if [ "$USER" != '*' ]; then echo -e "$(date "+%F %T") adding $udir" |tee -a $BACKUP/$user.log # Backup files and dirs - tar -cpf $tmpdir/user_dir/$udir.tar $udir - - # Compress arhive - gzip -$BACKUP_GZIP $tmpdir/user_dir/$udir.tar + tar -cpf- $udir |gzip -$BACKUP_GZIP - > $tmpdir/user_dir/$udir.tar.gz fi done set +f