المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How can you do daily Auto-backup for your vB forum ?



bahattab
09-01-2009, 01:28 AM
How can you do daily Auto-backup for your vB forum ?


You can use a cron job to do this and enter the standard shell backup command:




mysqldump --opt -Q -udbusername -pPassword -Ddatabasename > /path/to/backupname.sql



#!/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. http://www.atyafonline.com/vb/imgcache/1317.png

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.

My script is NOT a php file. It is a shell script.

You upload it to your website and then login to your web control panel (usually cPanel) and go to Cron Tabs and set it to run that script every 24 hours.

To run the script manually, login to your website using SSH (I use PuTTY utility). If you have saved that script as forumbackup.job, then type ./forumbackup.job to run it.



in vBulletin_v3.xx.zip archive has a do_not_upload/ folder, within it you can find a backup script for shell, you can use that to make a daily cron job for the database. Might also be worth to look into.




http://www.vbulletin.com/forum/showthread.php?p=898290#post898290




----------------------------



Auto-backup



Version: 3.7.x
Rating: http://www.atyafonline.com/vb/imgcache/1366.png (54 votes - 4.76 average)
Released: 08 Jan 2008
Last Update: 01 May 2008
Installs: 591
http://www.atyafonline.com/vb/imgcache/1367.pngSupported
http://www.atyafonline.com/vb/imgcache/1367.pngUses Plugins
http://www.atyafonline.com/vb/imgcache/1367.pngAdditional Files
http://www.atyafonline.com/vb/imgcache/1367.pngTranslations


http://www.atyafonline.com/vb/imgcache/1368.png

Note: The 3.8 release can be found here (http://www.vbulletin.org/forum/showthread.php?t=201319).

vBulletin 3.7 Version
Please remember to click Mark as Installed if you use this modification.
Support questions from members who have not marked this as installed will be considered low priority.

Note: Because I did not write the original version, but rather have modified & adapted it, support of this modification may be limited

When vb 3.5 first came out I was using this backup system (http://www.vbulletin.org/forum/showthread.php?t=78486) on my vb 3.0 - and having nothing better to use - I converted it to work on vb 3.5 (here (http://www.vbulletin.org/forum/showthread.php?t=112304)) and since then I have cut it down and adapted it, first for vb 3.6 and now for vb3.7.

The original version was by Trigunflame (http://www.vbulletin.org/forum/member.php?u=19191) and the rights to the code were bought by Zoints (D.Chapman) in January. In 2007 David gave me permission to release my adaptation.

I have stripped out much of the extra stuff that I do not use (or indeed, could not get to work). This is a simple (lite) version that does a php based dump of your database either as one file, or one file per table.

Notes:
* I will not add anything new to this, or spend vast amounts of time supporting it.
* This is a Lite version to allow people to use the basic backup functionality on 3.7.


History:

v3.7.001 : First version for vB 3.7.


Download Now
http://www.atyafonline.com/vb/imgcache/1369.png Auto-backup.zip (http://www.vbulletin.org/forum/attachment.php?attachmentid=79569&d=1209585857) (7.7 KB, 2345 downloads)

Show Your Support


Thank you for supporting this modification -> Click to Mark as Uninstalled (http://javascript%3Cb%3E%3C/b%3E:%20vborg_doinstall%28167276,%20false%29).
Thank you for supporting this modification -> Click to Clear Nomination (http://javascript%3Cb%3E%3C/b%3E:%20vborg_donominate%28167276,1,false%29) from Modification of the Month.
If you like this modification support the author by donating.
This modification may not be copied, reproduced or published elsewhere without author's permission.




http://www.vbulletin.org/forum/showthread.php?t=167276&highlight=auto+backup