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:
[email protected]Discuss:
https://www.donation...index.php?board=45.0Download:
https://www.donation...mf_backupscripts.zipLicense: 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.simplemac...x.php?topic=293441.0And 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.
//---------------------------------------------------------------------------