Home

georgfly

Back to classic project page

Donate here




Welcome to

woodyWebBacker, the php script that backs up your entire website + databases and sends it to you
written entirely in php
by

Project Admins:

This program is an extended, cleaned version of a script I found on the web. The original script was written by Jordi Romkema (http://www.jor-on.com) and Eric Nagel (http://www.ericnagel.com/2009/05/ftp-or-amazon-s3-server-backup-php-script.html). Check out their websites for more info e.g. on backing up onto s3 server.

Summary:

This php script compresses all your databases, and your entire website. The generated archives are optionally encrypted and split into smaller chunks that are then
1. copied to your ftp server
2. copied to your amazon s3 cloud space
3. sent to you per email
The script can be scheduled to run every x hours or days.
The program runs on both windows and linux server.

Details:

  1. shell_exec needs to be allowed on your server
  2. this script runs on windows and linux machines; windows machines need an installation of winrar (winrar does both, the compressing and the splitting); linux machines compress with 'tar' and additionally uses 'split' for splitting large archives
  3. it uses your servers mysqldump (mysqldump.exe on windows) function to dump all databases it can find and then compresses them with winrar / tar
  4. it compresses a specified root folder of your website including all subfolders (either all root-level subfolders and files into separate archives, or everything bundeled into one large archive)

    in case the backup-folder (the folder where we temporarily store the backup archives) is inside the website that is being backed up, it will be automatically excluded from the compression
  5. optionally encrypt archives (winrar can do this while it is compressing, for 'tar' the script uses 'gpg' subsequently)
  6. it splits all produced (encrypted) archives into chunks of specified size (winrar can do this while it is compressing, for 'tar' the script uses 'split' subsequently)
    to extract the split linux archives (e.g. html_20111020022526.tar.gz.000, etc.) on windows, you have to first fuse the partial archives using windows command line: copy /b html_20111020022526.tar.gz.* html_20111020022526.tar.gz
    the resulting tar.gz can be opened in winrar (if you have encrypted the archives, you have to gpg-decrypt them somehow, i havent checked this on windows, but i'm sure it's simple)
  7. it sends these archives to a specified email address, ftp server or amazon s3 server (i have never used the amazon function, so no guarantee that it works)
  8. you can set how long the backups will be kept on the ftp / s3 server before this script will again delete them (e.g. for 3 months); emails will NOT be automatically deleted
  9. you can set a time interval how often this script shall be executed (e.g. once a week);
  10. however, you need to set up a cron job for every e.g. 10 minutes since the script processes the data in chunks
    (e.g. it does not send all emails at once, but needs to be called repeatedly); when the entire backup- and sending process is completed, a timestamp will be stored in a small file to ensure that the script is not started again before the specified backup-interval
  11. the script also makes sure that it cannot be executed before the previous execution is completed (by safing a 'locked' tag in a small file); so - no worries about setting up the cron-job too frequently
  12. the script can also be started from a browser (e.g. if you cannot run a cron job on your server) by calling woodyWebBacker_execute.php
  13. we can override the specified time interval (9) by calling woodyWebBacker_execute.php?getvar1=ignoreinterval
  14. we can override the lock (11) (in the unlikely case that the script ever got stuck in a locked state) by calling woodyWebBacker_execute.php?getvar2=ignorelock

    (=> calling woodyWebBacker_execute.php?getvar1=ignoreinterval&getvar2=ignorelock should therefore force the start of the script under any circumstance)
  15. another way to remove lock and interval timestamp is to delete $process_file (see woodyWebBacker config settings) from the server, so the script can also forced to start immediately; a new $process_file will be generated automatically
  16. backup archives will be deleted from your webserver immediately after sending them away, the empty backup working folder is left for the next backup session and contains the small file that contains interval timestamp and lock tag ($process_file)