mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 13:01:52 -07:00
On-the-fly gzip compression
Reduces backup time, free space requirement and disk writes.
This commit is contained in:
parent
c8e03744ab
commit
e1d64b8730
1 changed files with 6 additions and 14 deletions
|
@ -205,10 +205,7 @@ if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB" != '*' ]; then
|
||||||
|
|
||||||
# Backup files
|
# Backup files
|
||||||
cd $HOMEDIR/$user/web/$domain
|
cd $HOMEDIR/$user/web/$domain
|
||||||
tar -cpf $tmpdir/web/$domain/domain_data.tar * ${fargs[@]}
|
tar -cpf- * ${fargs[@]} |gzip -$BACKUP_GZIP - > $tmpdir/web/$domain/domain_data.tar.gz
|
||||||
|
|
||||||
# Compress archive
|
|
||||||
gzip -$BACKUP_GZIP $tmpdir/web/$domain/domain_data.tar
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Print total
|
# Print total
|
||||||
|
@ -307,16 +304,14 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
|
||||||
|
|
||||||
# Backup emails
|
# Backup emails
|
||||||
cd $HOMEDIR/$user/mail/$domain_idn
|
cd $HOMEDIR/$user/mail/$domain_idn
|
||||||
|
accounts=()
|
||||||
for account in $(ls); do
|
for account in $(ls); do
|
||||||
exclusion=$(echo "$MAIL" |tr ',' '\n' |grep "$domain:")
|
exclusion=$(echo "$MAIL" |tr ',' '\n' |grep "$domain:")
|
||||||
exclusion=$(echo "$exclusion" |tr ':' '\n' |grep "^$account$")
|
exclusion=$(echo "$exclusion" |tr ':' '\n' |grep "^$account$")
|
||||||
|
|
||||||
# Checking exlusions
|
# Checking exlusions
|
||||||
if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then
|
if [ -z "$exclusion" ] && [[ "$MAIL_SYSTEM" =~ exim ]]; then
|
||||||
echo "$(date "+%F %T") + $account@$domain" |\
|
accounts+=($account)
|
||||||
tee -a $BACKUP/$user.log
|
|
||||||
touch $tmpdir/mail/$domain/accounts.tar
|
|
||||||
tar -rpf $tmpdir/mail/$domain/accounts.tar $account
|
|
||||||
else
|
else
|
||||||
echo "$(date "+%F %T") excluding mail account $account" |\
|
echo "$(date "+%F %T") excluding mail account $account" |\
|
||||||
tee -a $BACKUP/$user.log
|
tee -a $BACKUP/$user.log
|
||||||
|
@ -324,8 +319,8 @@ if [ ! -z "$MAIL_SYSTEM" ] && [ "$MAIL" != '*' ]; then
|
||||||
done
|
done
|
||||||
|
|
||||||
# Compress archive
|
# Compress archive
|
||||||
if [ -e "$tmpdir/mail/$domain/accounts.tar" ]; then
|
if [ ${#accounts[@]} -gt 0 ]; then
|
||||||
gzip -$BACKUP_GZIP $tmpdir/mail/$domain/accounts.tar
|
tar -cpf- ${accounts[@]} |gzip -$BACKUP_GZIP - > $tmpdir/mail/$domain/accounts.tar.gz
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -445,10 +440,7 @@ if [ "$USER" != '*' ]; then
|
||||||
echo -e "$(date "+%F %T") adding $udir" |tee -a $BACKUP/$user.log
|
echo -e "$(date "+%F %T") adding $udir" |tee -a $BACKUP/$user.log
|
||||||
|
|
||||||
# Backup files and dirs
|
# Backup files and dirs
|
||||||
tar -cpf $tmpdir/user_dir/$udir.tar $udir
|
tar -cpf- $udir |gzip -$BACKUP_GZIP - > $tmpdir/user_dir/$udir.tar.gz
|
||||||
|
|
||||||
# Compress arhive
|
|
||||||
gzip -$BACKUP_GZIP $tmpdir/user_dir/$udir.tar
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
set +f
|
set +f
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue