Need a smart DB backup script in bash

Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
I had seen many DB backup scripts which work but don't meet my custom requirements. Later i will add it to cron.

The script should be totally automated in getting home folder path, no hard coded paths need's to be written.

- It will back all available database's in HOME dir inside "BACKUP FOLDER"
- I will run it in cron every day, it should delete LAST 2 old backup's
- saved DB are tar.gz compressed for best compression ratio [obviously name of backed Db file is the datetimestamp]
- should check if lock table, should mail on provided mail id the log of backup success,if error it will log send error in body of mail [no attachment]

Previously i tried to write something from scratch but ended but getting my whole "public_html" folder deleted :oops:

Please get me this cpanel G33k's

Thanks

Note: Need professional work as my database's size various in GBs 280 +

Thanks
 
Last edited by a moderator:

linux4me2

Well-Known Member
Aug 21, 2015
259
80
78
USA
cPanel Access Level
Root Administrator
I'm not sure it will handle a database as large as yours, but I think sourceforge.net/projects/automysqlbackup/ might meet your other requirements. You can set the way it rotates backups in order to determine how many it keeps.
 
Last edited by a moderator:
Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
No my friend,didn't work for me just like other's. Backup at some point is corrupted, i had tried with different settings and max upload buffer etc etc, no success.

But if i use simple mysqldump with regular arg's then it work's.

So better i use this (simple mysqldump command) in my .sh backup script

Is there a way the backup (zip) is sent to dropbox ? [no S3 , amazon etc]

i had seen few open source, but i need your people advice which works for you always!
 
Last edited:

syslint

Well-Known Member
Verifed Vendor
Oct 9, 2006
271
7
168
India
cPanel Access Level
Root Administrator
Twitter
mysqldump backup is not a perfect solution for large db's with continuous updates. You need to consider Percona XtraBackup percona.com/software/mysql-database/percona-xtrabackup
 
Last edited by a moderator:
Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
mysqldump backup is not a perfect solution for large db's with continuous updates. You need to consider Percona XtraBackup percona.com/software/mysql-database/percona-xtrabackup
Thanks.

Why would mysqldump wont suffice ? Is there any official documentation which mentions limit for 'mysqldump' !