Schedule BackUp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SorentoUltimate
    New Member
    • Jul 2009
    • 13
    • 3.8.x

    Schedule BackUp

    Hello,

    How i can add a new Schedule Task for BackUp ???

    Thanks In Advance
    Giorgos
    http://www.sorento-ultimateclub.com/...x60/468x60.gif
  • Jose Amaral Rego
    Senior Member
    • Feb 2005
    • 11058
    • 1.1.x

    #2
    You would need to ask in over at vBulletin.org or use these reliable methods
    Originally posted by Steve Machol
    The only reliable method of backing up and restoring a database is with shell access via telnet or ssh. Please see the instructions here:

    Backup:


    Restore:


    This is because backing up with a PHP script like that in the Admin CP or phpMyAdmin can result in PHP timeouts errors and an incomplete backup file.

    The backups contain all the data - users, posts, threads, forums, settings, etc. Hopefullly you will never have a problem which requires you to restore it, but you should make frequent backups anyway.
    Originally posted by Andy Huang
    1. Login to cPanel
    2.
    --- If you are using default cPanel X skin ---
    Click on Cron jobs
    --- If you are using RV skin ---
    Look under Advance Tools to find Cron jobs (and click on it)
    3. Click on [Standard] (or advanced if you want, really no difference except how you input data)
    4. On "Command to run:" enter
    mysqldump --opt -Q -uyour_database_username -pyour_database_password dbname > /home/your_cpanel_username/www/backup/filename.sql
    * Be sure to replace all the things in bold with something meeting your requirements and ensure that there is NO SPACE between -u and your username, as well as -p and your password.
    5. Set the time, and click save
    Originally posted by Andy Huang
    This is what I use for my backup script; it can be ran multiple times per day (as long as you give it a different session stamp) and it won't over write until next week. It also compresses the data so it saves some disk space...

    Code:
    #!/bin/bash
    # backup.sh - Creates an archived database backup 
    # Alfarin 20050417
    SessionStamp=$1
    DateStamp=`date +%A`
    BK_FILE="DB_Backup_"$DateStamp"_"$SessionStamp".sql"
    BK_ARCH="DB_Backup_"$DateStamp"_"$SessionStamp".tar.bz2"
    DIR="/home/[b]YourCpanelUsername[/b]/backup"
    mysqldump --opt -u [b]DatabaseUsername[/b] -p[b]DatabasePassword[/b] [b]DatabaseName[/b] > $DIR"/"$BK_FILE
    tar -cvjf $DIR"/"$BK_ARCH $DIR"/"$BK_FILE
    rm -rf $DIR"/"$BK_FILE
    I have two cron scripts running, one runs at midnight of every day, the other runs at noon of every day.

    0 0 * * * /home/cPanelUsername/backup/backup.sh Midnight
    0 12 * * * /home/cPanelUsername/backup/backup.sh Noon

    It creates:
    /home/cPanelUsername/backup/DB_Backup_Monday_Midnight.tar.bz2
    /home/cPanelUsername/backup/DB_Backup_Monday_Noon.tar.bz2
    ... etc. for every day of the week, and overwrites up comes next week. My raw .sql is 4.5Mb (fairly new site + cerberus helpdesk database) and it compresses it down to ~660Kb per backup session. It saves quite a bit of disk space so I can afford to keep 14 backups at a time as it takes about the same space as two uncompressed backups.
    Originally posted by feldon23
    Code:
    #!/bin/sh
    # Backup description
    fdesc='FORUMNAME'
    # Backup filename
    fname='BACKUPNAME'
    # Destination directory (with trailing slash)
    fdir=BACKUPDIR
    # Database Settings:
    fdb=DBNAME
    fuser=DBUSERNAME
    fpw=DBPASSWORD
    
    echo "Backing up $fdesc database..."
    tempname=$fdir$fname-`eval date +%Y-%m-%d`.sql
    mysqldump --opt -quick -u$fuser -p$fpw $fdb > $tempname
    echo "Gzipping $fdesc database..."
    gzip $tempname
    a=`eval date +%d`
    a=`expr $a - 2`
    echo "Deleting old backups... (Error messages are normal)"
    tempname=$fdir$fname-`eval date +%Y-%m-`$a.sql.gz
    rm $tempname
    tempname=$fdir$fname-`eval date +%Y-%m-`0$a.sql.gz
    rm $tempname
    This is a crontab script. I have mine set to run every morning at 4AM. It exports the database with a name like forumbackup-2005-04-29.sql.gz, gzips it (readable with WinZip), and deletes the backup from 2 days ago. If today is June 24th, when the script runs, it will try to delete June 22nd so you end up with just June 23rd and June 24th. On the first of every month, it does not delete the last backup of the previous month. Let's call this a bug/feature.

    You must change FORUMNAME, BACKUPNAME, BACKUPDIR, DBNAME, DBUSERNAME, DBPASSWORD. Here are examples:

    FORUMNAME = My vB3 Forum
    BACKUPNAME = vb3forumbackup
    BACKUPDIR= /home/feldon29/forumbackups/
    DBNAME = feldon29_vbforum
    DBUSERNAME = feldon29
    DBPASSWORD = 87t3r6e

    BACKUPDIR needs to be the pathname where you want your backups saved. Realize that crontabs see the world differently than your FTP account. When you login with FTP and see /public_html/, the cron tab might see this as /home/bubba/public_html/. You need to put the full pathname into BACKUPDIR.

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...