Welcome Guest.   Make a donation to an author on the site August 19, 2014, 11:54:20 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: SMF Forum Backup Scripts (perl and bash code to backup db and new uploads)  (Read 4638 times)
mouser
First Author
Administrator
*****
Posts: 33,238



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: July 29, 2011, 08:27:47 PM »

I'm uploading a pack of smf forum backup scripts i wrote.

There are no magical commands here -- just mostly an automating of standard database dump and tar/zip operation.

Even if you are not using the smf forum, the basic code could be useful to you if you are running a server and want a nightly backup of a database and/or newly uploaded files.



//---------------------------------------------------------------------------
Title: Backup scripts for SMF forum data
Date: 7/29/11
By: mouser@donationcoder.com
Discuss: http://www.donationcoder....orum/index.php?board=45.0
Download: http://www.donationcoder....p/dcsmf_backupscripts.zip
License: Open Source whatever
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
WHAT THIS IS:

A package of backup scripts (in bash shell script and perl languages), that
 are meant to be used to perform nighly backups of your smf database and
 attachment directory.

It will put your forum in maintenance mode while it runs the database
 backup.

Note: This has been tested with smf 1.x but should work on any version;
 it has been tested with INNODB tables; if you use another database engine
 it may be possible to modify the code to do backup without locking tables.
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
HOW TO USE:

First, you need to customize the files in the settings directory, to specify
 the directories where your smf forum and attachments are located, and where
 you want the created databases and attachment zips to be placed.

Then upload all files, and set them to be +x.  Create any destination directories
 you have specified.

Then have your daily cron run the runmybackups.sh file, or run it manually to test.
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
NOTES:

Database backups are named by Weekday (Mon,Tue,etc.) and will rotate and overwrite
 as the week recycles.  Except that on one day per week it will create a file
 named with the month, so that you will have one backup file per month up to a year old.

The attachment zipping is incremental.  Unlike the database backup, the script will
 always create a new file with new attachments since the last run.  It will never overwrite
 or remove old files.

You might use a file synchronizing ftp program to automatically download new backup files.
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
CREDITS:

I took the detailed instructions from code posted by user Vekseid on the smf
 forum: http://www.simplemachines.../index.php?topic=293441.0
And just tried to make a fuller configurable script out of it, plus added
 a helper script for backing up attachment files, which is important for us.
//---------------------------------------------------------------------------
« Last Edit: July 30, 2011, 07:49:02 AM by mouser » Logged
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,952



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: July 30, 2011, 04:38:27 AM »

Is this SMF specific or will it work with any DB and collection of folders? Also can you include more than one DB?
Logged

mouser
First Author
Administrator
*****
Posts: 33,238



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: July 30, 2011, 07:02:34 AM »

It has some very specific code for smf stuff (like grabbing settings from the smf .php file and modifying this file to put it into maintenance mode), etc.

So for other uses you will have to modify quite a bit.

But it may still be useful as a skeleton for customization as it demonstrates how to do a few useful and tricky things.
Logged
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,952



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: July 30, 2011, 07:12:23 AM »

Thanks - I'll take a look

I was wondering if I could mod it to work with WordPress websites - there really aren't any good automatic backup options for them.
Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.039s | Server load: 0.08 ]