Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    191

    Arrow Email DB Backup?

    Is it possible to have the bash script, that is executed using a cron job, posted below email the DB backup to me as well as saving a copy to the server as it is currently doing?

    # Script Function:
    # This bash script backups up the "DBname" and "DBname" db everyday at 4am with a file name time stamp and tar.gz zips the file.
    # The "DBname" db will be saved in /backups/database_backups/"DBname"/
    # The "DBname" db will be stored in /backups/database_backups/"DBname"/
    # Db backups older than 30 days will be deleted.

    #[Changes Directory]
    cd /home/"accountname"/backups/

    #[Old DB Deletion Script]
    find /home/"accountname"/backups/database_backups -name "*.tar.gz" -mtime +30 -exec rm -f {} \;

    #[Stamps the file name with a date]
    TIMESTAMP=`date +%m-%d-%y-%H%M`


    #[DB Backup Scripts]

    # "DBname"
    HOST=localhost
    DBNAME="DBname"
    USER="DBusername"
    PASSWORD="DBpassword"
    DUMP_PATH=/home/"accountname"/backups/database_backups/"DBname"
    mysqldump --opt -c -e -Q -h$HOST -u$USER -p$PASSWORD $DBNAME > $DBNAME.sql
    tar czpf $DUMP_PATH/$DBNAME.$TIMESTAMP.tar.gz $DBNAME.sql
    rm -f $DBNAME.sql

    # "DBname"
    HOST=localhost
    DBNAME="DBname"
    USER="DBusername"
    PASSWORD="DBpassword"
    DUMP_PATH=/home/"accountname"/backups/database_backups/"DBname"
    mysqldump --opt -c -e -Q -h$HOST -u$USER -p$PASSWORD $DBNAME > $DBNAME.sql
    tar czpf $DUMP_PATH/$DBNAME.$TIMESTAMP.tar.gz $DBNAME.sql
    rm -f $DBNAME.sql
    Last edited by Fernis; 05-02-2007 at 10:40 AM. Reason: Forgot to include bash script
    Owner/President
    Booyah! Web Hosting
    Great Personal Service
    Experience the Booyah! Difference

Similar Threads & Tags
Similar threads

  1. How to backup all email?
    By leomessi in forum New User Questions
    Replies: 1
    Last Post: 06-07-2011, 04:27 PM
  2. backup one email account?
    By alancy in forum E-mail Discussions
    Replies: 2
    Last Post: 07-12-2010, 01:36 AM
  3. Backup email
    By itzhero in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 11-16-2008, 04:41 PM
  4. Backup email
    By dan223 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 01-21-2008, 01:21 PM
  5. Backup to Email.
    By madtom in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 08-05-2005, 08:06 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube