The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need a smart DB backup script in bash

Discussion in 'Data Protection' started by SpiritualWorlds, Mar 4, 2016.

  1. SpiritualWorlds

    Joined:
    Mar 3, 2016
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
    #1 SpiritualWorlds, Mar 4, 2016
    Last edited by a moderator: Mar 4, 2016
  2. linux4me2

    linux4me2 Well-Known Member

    Joined:
    Aug 21, 2015
    Messages:
    83
    Likes Received:
    15
    Trophy Points:
    8
    Location:
    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.
     
    #2 linux4me2, Mar 6, 2016
    Last edited by a moderator: Mar 7, 2016
  3. SpiritualWorlds

    Joined:
    Mar 3, 2016
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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!
     
    #3 SpiritualWorlds, Mar 7, 2016
    Last edited: Mar 7, 2016
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Why not use the script you just posted about (now deleted) in another thread?
     
    SpiritualWorlds likes this.
  5. SpiritualWorlds

    Joined:
    Mar 3, 2016
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    It was not working properly for DB having size more than 10 GB's o_O
     
  6. syslint

    syslint Well-Known Member

    Joined:
    Oct 9, 2006
    Messages:
    249
    Likes Received:
    6
    Trophy Points:
    18
    Location:
    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
     
    #6 syslint, Mar 7, 2016
    Last edited by a moderator: Mar 7, 2016
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  8. SpiritualWorlds

    Joined:
    Mar 3, 2016
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    Thanks.

    But i need a open source solution for exact same task.
     
    #8 SpiritualWorlds, Mar 8, 2016
    Last edited: Mar 8, 2016
  9. SpiritualWorlds

    Joined:
    Mar 3, 2016
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    Thanks.

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

Share This Page