1

Topic: backup script

==== Required information ====
- iRedMail version: 0.8.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Ubuntu 14.04
- Related log if you're reporting an issue:
====

The daily backup script gives some strange output:

bzip2: Output file /var/vmail/backup/mysql/2014/11/23/mysql-2014.11.23.03.30.01.sql.bz2 already exists.
bzip2: Output file /var/vmail/backup/mysql/2014/11/23/vmail-2014.11.23.03.30.01.sql.bz2 already exists.
bzip2: Output file /var/vmail/backup/mysql/2014/11/23/roundcubemail-2014.11.23.03.30.01.sql.bz2 already exists.
bzip2: Output file /var/vmail/backup/mysql/2014/11/23/iredadmin-2014.11.23.03.30.01.sql.bz2 already exists.
==> Backup completed successfully.
==> Detailed log (/var/vmail/backup/mysql/2014/11/23/2014.11.23.03.30.01.log):
=========================
* Starting backup: 2014.11.23.03.30.01.
* Backup directory: /var/vmail/backup/mysql/2014/11/23.
* Backing up databases ...
  - roundcubemail [DONE]
  - iredadmin [DONE]
  - mysql [DONE]
  - vmail [DONE]
  - mysql [DONE]
  - vmail [DONE]
  - cluebringer [DONE]
  - amavisd [DONE]
  - roundcubemail [DONE]
  - iredadmin [DONE]
* File size:
----
20K    /var/vmail/backup/mysql/2014/11/23/amavisd-2014.11.23.03.30.01.sql.bz2
8.0K    /var/vmail/backup/mysql/2014/11/23/cluebringer-2014.11.23.03.30.01.sql.bz2
8.0K    /var/vmail/backup/mysql/2014/11/23/iredadmin-2014.11.23.03.30.01.sql
4.0K    /var/vmail/backup/mysql/2014/11/23/iredadmin-2014.11.23.03.30.01.sql.bz2
528K    /var/vmail/backup/mysql/2014/11/23/mysql-2014.11.23.03.30.01.sql
104K    /var/vmail/backup/mysql/2014/11/23/mysql-2014.11.23.03.30.01.sql.bz2
56K    /var/vmail/backup/mysql/2014/11/23/roundcubemail-2014.11.23.03.30.01.sql
12K    /var/vmail/backup/mysql/2014/11/23/roundcubemail-2014.11.23.03.30.01.sql.bz2
20K    /var/vmail/backup/mysql/2014/11/23/vmail-2014.11.23.03.30.01.sql
4.0K    /var/vmail/backup/mysql/2014/11/23/vmail-2014.11.23.03.30.01.sql.bz2
----
* Backup completed (Success? YES).

------------------
It says SUCCESS - I am just wondering why it says several files already exists, and furthermore if all files are zipped and duplicates removed.

In the backup dir I have the following files:
root@mail:/var/vmail/backup/mysql/2014/11/23# ls -l
total 768
-rw-r--r-- 1 root root   1135 Nov 23 03:30 2014.11.23.03.30.01.log
-rw-r--r-- 1 root root  16550 Nov 23 03:30 amavisd-2014.11.23.03.30.01.sql.bz2
-rw-r--r-- 1 root root   5386 Nov 23 03:30 cluebringer-2014.11.23.03.30.01.sql.bz2
-rw-r--r-- 1 root root   6209 Nov 23 03:30 iredadmin-2014.11.23.03.30.01.sql
-rw-r--r-- 1 root root   2060 Nov 23 03:30 iredadmin-2014.11.23.03.30.01.sql.bz2
-rw-r--r-- 1 root root 539399 Nov 23 03:30 mysql-2014.11.23.03.30.01.sql
-rw-r--r-- 1 root root 104523 Nov 23 03:30 mysql-2014.11.23.03.30.01.sql.bz2
-rw-r--r-- 1 root root  56771 Nov 23 03:30 roundcubemail-2014.11.23.03.30.01.sql
-rw-r--r-- 1 root root   9991 Nov 23 03:30 roundcubemail-2014.11.23.03.30.01.sql.bz2
-rw-r--r-- 1 root root  20256 Nov 23 03:30 vmail-2014.11.23.03.30.01.sql
-rw-r--r-- 1 root root   2938 Nov 23 03:30 vmail-2014.11.23.03.30.01.sql.bz2
root@mail:/var/vmail/backup/mysql/2014/11/23#



Best regards,
Henrik

----

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

2

Re: backup script

I found out the duplicate issue - but the plain files are not deleted smile

In /var/vmail/backup/backup_mysql.sh the databases are listed twice:
export DATABASES=" roundcubemail iredadmin mysql vmail mysql vmail cluebringer amavisd roundcubemail iredadmin"

but regarding deleting plain files:
# Delete plain SQL files after compressed. Compressed copy will be remained.
export DELETE_PLAIN_SQL_FILE="YES"


'YES' does not seem to work.

Best regards,
Henrik

3

Re: backup script

Hmm indeed, twice the word mysql in the EXPORT part.
And sql files are not removed after compressing.
Using 0.8.7 too.

Is it a bug, twice mysql? Can it be removed?

4

Re: backup script

Please remove duplicate database names.

5

Re: backup script

According to not removing the plain sql file, line 156 needs to be changed:

old:            if [ X"$?" == X'0' -a X"${DELETE_PLAIN_SQL_FILE}" == X'YES' ]; then

new:            if [ X"${DELETE_PLAIN_SQL_FILE}" == X'YES' ]; then

The first part is wrong, as you are already in that if loop. Removing this will delete the plain sql files.

6

Re: backup script

Please try the one shipped in the latest development version of iRedMail, it has some code changes, and no variable "DELETE_PLAIN_SQL_FILE" anymore:
https://bitbucket.org/zhb/iredmail/raw/ … p_mysql.sh

7

Re: backup script

Great. will use that one.

Tested, works great.

8

Re: backup script

yes! thanks - this can be closed smile