Daily Site Backup - Drupal 6 Module

Attached File(s): 

hardrive_000.jpg

Update! You can now split backups into chunks for easier emailing.

This module is intended for drupal sites running linux or unix.  It will create an archive of your site (or multi-site) allowing you to specify included and/or excluded files and directories. Ex: modules, themes, etc.  It can then email it to an address of your choice.  I recommend a gmail account, as you get several gigs of storage for free.

This module will actually issue a tar command to the command line.  This is why you need to be running either unix or linux.

Note:  This module plays very nicely with my other module, Daily MySQL Backup!

Also of note: This module plays especially well with my new desktop backup program, psBackup, which is able to download files from the web as well as regular file backups.

It should be noted that there is no encryption done on the backup files themselves, and a very crafty visitor might be able to guess the exact filename of your site backups (and thus, be able to download them).  However, the module does have a filename obfuscation feature, which makes it exceedingly difficult for a visitor to guess a filename.

Why not use "Backup and Migrate Files?"  Backup and Migrate Files is a perfectly fine module, but it only backs up what is in your /files directory.  As a drupal developer, you usually also want your custom modules, themes, etc, backed up as well.  This is even more important if you have a multisite install.

Features

  • Creates a tar.gz "tarball" backup of any files or directories under your /sites directory.  This is very helpful for multisite installs.
  • Filename obfuscation, which makes it exceedingly difficult for a malicious visitor to guess the backup filenames.
  • Include or exclude files and directories.  Can use wildcards.
  • Backup lifetimes, meaning that backups will automatically be deleted after a certain amount of time.  Ex: 7 days.
  • Backups can be emailed to a specified email address for off-site storage.
  • Backups can be split into 1-100mb chunks, then emailed.  This is for when you are on a webhost which does not allow email attachments of a certain size.
    • Uses the "split" linux command.
    • To restore from split, copy all of the pieces into the same directory and type:
      cat name_of_pieces* > output.tar.gz

 Installation

  • Unpack the module files into /sites/all/modules/daily_site_backup. Visit your admin/build/modules page in Drupal and enable the module.
  • Visit the admin/settings/daily_site_backup page to configure the module.
  • Make sure your cron is set to run at least once an hour.  The backups are triggered by the cron.
  • If you are using my other module, Daily Mysql Backup, set this module to run at least one hour after the mysql backup, to ensure it gets the latest db snapshot.

Please note: this module sends back installation notifications to richardpeacock.com.  No personal data is collected, just installation details and version number. It is strictly for my own curiosity, to see how many sites have installed my module.  You can disable this easily by visiting admin/settings/daily_site_backup.

 


Software License Fine Print

Creative Commons LicenseThis code is licensed as-is, with no warranty or guarantee, under a Creative Commons Attribution 3.0 Unported License.

You may use this code however you want, even in commercial products, but only if you include attribution to me, Richard Peacock, as the original author of this small portion of code, but not in a way that implies I endorse your project.

For example, on a Help/Credits screen:  Portions of this project were based on work freely obtained from these developers: Richard Peacock (http://richardpeacock.com), NAME HERE, etc.  These outside developers neither endorse nor support this software.

If you use this code, feel free to email me to let me know!  I'll include a link to your project here.