Backing up forum?
Hey i have a site and was wondering if someone could tell me step by step how to back up my forum?I have vbulletin and was wondering how to go about this
Hey i have a site and was wondering if someone could tell me step by step how to back up my forum?I have vbulletin and was wondering how to go about this
mairving posted this at 02:49 — 6th October 2005.
They have: 2,256 posts
Joined: Feb 2001
Plenty of ways to do it. Here is one way.
timjpriebe posted this at 12:14 — 6th October 2005.
He has: 2,667 posts
Joined: Dec 2004
If you have CPanel or something similar, there is likely a built in option that says "Back up database"
mairving posted this at 13:43 — 6th October 2005.
They have: 2,256 posts
Joined: Feb 2001
Here is one that I use that backups the database and ftp's the backup to another server (note: you don't have to tell it the db name, since it will backup all that you have permission to):
#!/bin/bash
#####################################
### MySQL Configuration Variables ###
#####################################
# MySQL Hostname
DBHOST='$hostname'
# MySQL Username
DBUSER='$mysql_username'
# MySQL Password
DBPASSWD='$mysql_password'
#####################################
### FTP Configuration Variables #####
#####################################
# FTP Hostname
FTPHOST='$remote_ftpsite'
# FTP Username
FTPUSER='$remote_username'
# FTP Password
FTPPASSWD='$remote_password'
# Local Directory for Dump Files
LOCALDIR='$local_directory'
# Remote Directory for Offsite Backup
REMOTEDIR='$remote_directory'
# Prefix for offsite .tar file backup
TARPREFIX='$tar_prefix'
#####################################
### Edit Below If Necessary #########
#####################################
cd $LOCALDIR
SUFFIX=`eval date +%m%d%Y-%k%M`
DBS=`/usr/local/bin/mysql -u$DBUSER -p$DBPASSWD -h$DBHOST -e"show databases"`
for DATABASE in $DBS
do
if [ $DATABASE != "Database" ]; then
FILENAME=$SUFFIX-$DATABASE.gz
/usr/local/bin/mysqldump --opt -Q -u$DBUSER -p$DBPASSWD -h$DBHOST $DATABASE | gzip --best > $LOCALDIR$FILENAME
fi
done
chmod 400 $LOCALDIR*.gz
tar -cf $TARPREFIX-$SUFFIX.tar $SUFFIX-*.gz
ftp -n $FTPHOST <<END_SCRIPT
quote USER $FTPUSER
quote PASS $FTPPASSWD
cd $REMOTEDIR
put $TARPREFIX-$SUFFIX.tar
quit
END_SCRIPT
rm -f $TARPREFIX-$SUFFIX.tar
exit 0
Here is another that will backup your db and send it to your gmail account. I haven't tested it though.
<?php
// Mysql Database Info:
$database = "db_name"; // name of the database.
$username = "db_uname"; // username with access to database.
$password = "db_pass"; // password for username.
// E-mail Information:
$mailto = ""; // email address to send the database to.
$fromaddr = ""; // Email addres this should be shown as sent from
$subject = "$database backup for ".date("F d, y"); // subject of email.
$message = "Here is the $database database backup"; // message body.
// Options:
$compress_file = '1'; // 1 = Compress the sql file with tar.gz 0 = Make it a plain text sql file.
$send_email = '1'; // 1 = send backup copy via e-mail. 0 = just backup data, don't e-mail.
$delete_local = '1'; // 1 = delete local copy when done. 0 = leave local copy when done.
// Database Backup Filename & Location
$backupas = 'backup-'.$database.'-'.date("Y_m_d_H_i"); // filename to backup the database as.
$backupto = '/home/username/public_html/upload'; // absolute path to folder containing database -
no trailing slash. - must be a writeable location
// END of variables.
// Do Not Edit Beyond This Point
//Global Variables
$mail_boundary = '';
passthru ("mysqldump -u$username -p$password $database >$backupto/$backupas.sql", $error);
if($error) { echo "Problem: $error with backup"; exit;}
if ($compress_file) {
passthru ("tar -cpzf $backupto/$backupas.tar.gz $backupto/$backupas.sql",$error);
if($error) { echo "Problem: $error with compress"; exit;}
unlink("$backupto/$backupas.sql");
$backupas = "$backupas.tar.gz";
} else {
$backupas = "$backupas.sql";
}
if ($send_email) {
$mail_boundary = md5(uniqid(time()));
$mail_head = "From: $fromaddr\r\n";
$mail_head .= "X-Mailer: PHP/" . phpversion();
$mail_head .= "MIME-Version: 1.0\r\n";
$mail_head .= "Content-type: multipart/mixed;boundary=\"$mail_boundary\"";
$mail_head .= "\r\n\r\n";
$mail_head .= "This is a multi-part message in MIME format.";
$mail_head .= "\r\n\r\n";
$db_file = "$backupto/$backupas";
$fp = fopen($db_file, "r");
$file = fread($fp, filesize($db_file));
$file = chunk_split(base64_encode($file));
$mail_body = "--$mail_boundary\n";
$mail_body .= "Content-type: text/plain; charset=us-ascii\r\n";
$mail_body .= "Content-transfer-encoding: 8bit\r\n\r\n";
$mail_body .= " $message\r\n";
$mail_body .= "--$mail_boundary\r\n";
$filename = basename($db_file);
$mail_body .= "Content-type: application/octet-stream; name=$filename\r\n";
$mail_body .= "Content-transfer-encoding:base64\r\n\r\n";
$mail_body .= $file. "\r\n\r\n";
$mail_body .= "--$mail_boundary--";
mail($mailto, $subject, $mail_body, $mail_head);
}
if ($delete_local) {
unlink("$backupto/$backupas");
}
?>
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
bleep posted this at 15:09 — 6th October 2005.
They have: 6 posts
Joined: Sep 2005
thanks everyone
Aven101 posted this at 02:27 — 29th November 2005.
They have: 3 posts
Joined: Nov 2005
You should also consider backing up your database every once in a while, in case anything bad happens
Because it happened to me, and I lost everything
mairving posted this at 03:19 — 29th November 2005.
They have: 2,256 posts
Joined: Feb 2001
Every once and awhile ain't going to cut it. If you care about back it up daily using a cron job. Set it, test it regularly and you will feel much better if your data suddenly disappears.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
lamad posted this at 16:00 — 2nd December 2005.
They have: 14 posts
Joined: Dec 2005
agreed with mairving. nothing compares to automated frequent backups.
backing up is actually quite simple. have two machines, both connected to the internet and at physically seperate locations if your concerned about the building burning down, etc.
have a cron job that runs nightly.
rysnc your web and sql root directories to the backup server.
ftp is too insecure, sftp secure but still slow. rsync has many advantages. the rsync website has various backup examples. i recomend a 7 day rotating backup.
mairving posted this at 16:19 — 2nd December 2005.
They have: 2,256 posts
Joined: Feb 2001
I wouldn't rsync your db directory. I think that is what you are talking about. The reason is that you can get a corrupt database if you rsync it while you are writing to it. It would be better to dump the db, then sync that up. Rsync is a great program but make sure that it is secured before you use it.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
James posted this at 23:58 — 12th December 2005.
He has: 127 posts
Joined: Dec 2005
Here is a semi-automated backup method via cron jobs.
1: Save the following text as a file ending in ".pl"
2: Upload it in text FTP transfer mode (not binary) to your cgi-bin directory
3: Create a cronjob to execute this script every timecycle you want.
free-space.net: free cpanel web hosting for new webmasters
sitemanaged: click here to visit our site
Premium quality web hosting for the elite webmasters and hosts. (ThePlanet and Savvis networks)
Contact me for a quote today and discuss your requirements.
DC_Sara posted this at 23:49 — 14th December 2005.
She has: 392 posts
Joined: Jan 2002
I back up my Vbulletin every night through PHP admin via Hsphere.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.