1

Topic: backup_mysql.sh via 7zip

======== Required information ====
- iRedMail version: 0.9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MysQL
- Web server (Apache or Nginx): Apache2
- Linux/BSD distribution name and version:  Ubuntu Server LTS
- Related log if you're reporting an issue:
====

If someone interested attacched a variation to the backup_mysql.sh script set to compress via 7zip
The only modification to do is change the four following lines:

080: export CMD_COMPRESS='7z -mx=9 -bd  -t7z a '
154:            ${CMD_COMPRESS} ${output_sql}.7z ${output_sql} >>${LOGFILE}
161:            if echo ${CMD_COMPRESS} | grep '^7z' >/dev/null; then
162:                compressed_file_name="${output_sql}.7z"

JC

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: backup_mysql.sh via 7zip

Thanks for sharing. bzip2 will be installed by iRedMail, and i think 'bzip2 -9' is pretty good. smile

By the way, i updated iRedMail/tools/backup_*.sh, it's able to delete old backup copies automatically, to save disk space. With default setting, old backup copies will be kept for 90 days.

3 (edited by JoeVr 2015-04-26 18:06:12)

Re: backup_mysql.sh via 7zip

ZhangHuangbin wrote:

Thanks for sharing. bzip2 will be installed by iRedMail, and i think 'bzip2 -9' is pretty good. smile

By the way, i updated iRedMail/tools/backup_*.sh, it's able to delete old backup copies automatically, to save disk space. With default setting, old backup copies will be kept for 90 days.

About diferences between bzip2 -9 and 7z -mx=9 give a look to this:

-rw-r--r-- 1 root root 56745472000 apr 25 12:15 posta.tar
-rw-r--r-- 1 root root 39548728798 apr 25 12:15 posta.tar.bz2
-rw-r--r-- 1 root root 28412601584 apr 25 15:29 posta.tar.7z

as you can read 7z reduces from 53gb to 27gb, bzip2 "only" to 37gb

Consider that the file is a pure tar (couse 7z by it self does not manipulate well permissions) of the /var/vmail/ dir of a 25 email user system alive since 2010.

About the backup in the past, i wrote on the fly a remote weekly rotative backup: if you findi it usefull use it as you wish:

#!/bin/bash
cd /home/BackUp-Sito
oggi=`date`
tar cvf /home/sito.tar /home/http/miosito.it/ &>/dev/null
case ${oggi:0:3} in
lun )
percorso=”/home/Backup/Sito/lun/”;;
mar )
percorso=”/home/Backup/Sito/mar/”;;
mer )
percorso=”/home/Backup/Sito/mer/”;;
gio )
percorso=”/home/Backup/Sito/gio/”;;
ven )
percorso=”/home/Backup/Sito/ven/”;;
sab )
percorso=”/home/Backup/Sito/sab/”;;
dom )
percorso=”/home/Backup/Sito/dom/”;;
esac
scp -P XXXXX /home/sito.tar root@light.star-highway.net:$percorso &>/dev/null
echo ‘************** ‘ `date –rfc-3339=seconds` ‘ **************’ >> /var/log/gb_site_backup.log

Of course you should change the tripet letter case with the three first letters of the day name in your language smile

JC