1

Topic: [Bug+FetureRequest] no error warining in Mysql Backup Script

summary
bug:
* there is no error shown on database connection error in the backup script; there should be a warning message in the command
* the backup integrity should be checked, to small files should result in a warning

feature:
+ there should be a warning message in the admin interace if backup is failing
+ the backup system should also being automatically installed and setup in the installation wizard (including cron setup)
+ the backup system also should be able to backup the maildir
+ only one backup script has to be called. the script do the rest.
+ a section in the admin where i can see when the last backups where running, how big the files are, and an option to keep only the last x backups (like in http://www.activecollab.com/docs/manual … ta-backup)
+ backups should be easily restoreable. just setup a blank iredmail server; copy one large backup zip; call the restore script; everything should be up and running.

longer version:
as iredmail is such a great "fire & forget" system (have never installed a mailserver so fast), also the backup system should be that easy and integrated.

root@server ~/iRedMail-0.7.0-rc1/tools # bash backup_mysql.sh
root@server ~/iRedMail-0.7.0-rc1/tools #

if i install the system and brain-afk assume that the install scripts also sets the password and names in the backup script i run into the situation, that i create a lot of backups with the script and if i have to rely on the backup it can be a bad supprise that all the sql files are empty because the backup script had no database connection. which can also happen if a anything prevents the mysql server connection (for the moment, for this one program, allways,...).

the backup script should show a warning message on a db connection error. best would be that if i log into the admin interface i see a warning "your backup is failing"

the logfile shows the problem (should also tell me "backup completed with errors" on the last line):

* Starting backup: 2011.05.11.15.04.44.
* Log file: /backup/logs/2011.05//mysql-2011.05.11.15.04.44.log.
* Backup copies: /backup/mysql/2011.05/2011.05.11.
* Backing up database: mysql...mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
    Done
* Backing up database: vmail...mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
    Done
* Backing up database: policyd...mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
    Done
* Backing up database: roundcubemail...mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
    Done
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.14.22.39.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.14.22.39.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.14.28.35.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.14.28.35.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.15.04.44.sql...    Done
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.14.22.39.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.14.22.39.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.14.28.35.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.14.28.35.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.15.04.44.sql...    Done
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.14.22.39.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.14.22.39.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.14.28.35.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.14.28.35.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.15.04.44.sql...    Done
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.14.22.39.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.14.22.39.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.14.28.35.sql.bz2...bzip2: Input file /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.14.28.35.sql.bz2 already has .bz2 suffix.
* Compressing plain SQL file: /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.15.04.44.sql...    Done
* File size:
4.0K    /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.14.22.39.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.14.28.35.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/mysql.2011.05.11.15.04.44.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.14.22.39.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.14.28.35.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/policyd.2011.05.11.15.04.44.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.14.22.39.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.14.28.35.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/roundcubemail.2011.05.11.15.04.44.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.14.22.39.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.14.28.35.sql.bz2
4.0K    /backup/mysql/2011.05/2011.05.11/vmail.2011.05.11.15.04.44.sql.bz2
* Backup complete.

----

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

2

Re: [Bug+FetureRequest] no error warining in Mysql Backup Script

Thanks very much for your feedback.

c33s wrote:

* there is no error shown on database connection error in the backup script; there should be a warning message in the command

Fixed. It now will show error like below:

[ERROR] You don't have correct MySQL related configurations in file: backup_mysql.sh
    - MYSQL_USER
    - MYSQL_PASSWD
    - DATABASES
Please configure them first.

Another error:

[ERROR] MySQL username or password is incorrect in file backup_mysql.sh.
Please fix them first.
c33s wrote:

* the backup integrity should be checked, to small files should result in a warning

It's hard to say which file size is correct. So we simply show the file size in backup log.

3

Re: [Bug+FetureRequest] no error warining in Mysql Backup Script

c33s wrote:

+ there should be a warning message in the admin interace if backup is failing
+ a section in the admin where i can see when the last backups where running, how big the files are, and an option to keep only the last x backups

Good idea. Will consider achieve it.

c33s wrote:

+ the backup system should also being automatically installed and setup in the installation wizard (including cron setup)

Fixed:
http://code.google.com/p/iredmail/sourc … 727cbc1b3e

+ the backup system also should be able to backup the maildir

No plan yet.

4

Re: [Bug+FetureRequest] no error warining in Mysql Backup Script

thank you for your effort to implement the features, have not seen you answered here (i allways miss the "subscribe" checkbox smile )

It's hard to say which file size is correct. So we simply show the file size in backup log.

a small integrety check is simple i think.
if i make a database dump of a fresh installed iredmailadmin, the database does have a minimum size. if it is below or much below there is something wrong. lets say a default dump has 0.5mb and the first dump creates a 1k file -> error.

also you could allways save the last 10 database dump sizes, they should getting bigger, or only a little bit smaller. if you have 10mb, 11mb, 12mb, 3mb there should be a warning.
of course i can have deleted a lot of stuff, but then i can approve the warning and everything is ok.