Last updated 19 April 2006. Created on 19 April 2006.
Edited by cel4145, dale42. Log in to edit this page.

To use the script modify the variables in the Configuration block to specify the instance being backed up.

The script will default the backup file name to value of tarnamebase appended with the date. The default value of tarnamebase is fullsitebackup. e.g.: fullsitebackup-2006-04-14.tgz. This name can be overridden by specifying a filename in parameter P1.

The script is run using the normal Bash script invocation for your system. e.g.:
  $ sh
  $ bash

You will be prompted for the database password. The backup file is placed in the same directory the script is run from.

If multiple sites are hosted on the same system, create a copy of the script for each instance and rename it to reflect the backup it will perform. For example, for a site named mysite1, create a copy of named You should also modify the tarnamebase variable to be more description of the site.

Usage notes and warnings:

  • This script backs up every file and directory in the Drupal root directory. If you have a hosted site with subdomain websites contained in subdirectories a backup of the main website directory will include the subdomain websites. For backups this will only bloat your backup file. For restores this could be disastrous, since you would restoring the file systems for ALL of the website. If you have this kind of configuration you must customize the tar command to make a selective backup.
  • This script does not understand Drupal multisite configurations
  • This script does not lock out users while the backup is in progress
  • Read access is required on all files and directories (this is sometimes a problem in hosted configurations)
  • The mysqldump utility uses the --add-drop-table option so that a restore automatically replaces tables. You may wish to modify this to add an element of safety to your restore process. (e.g., tables must be manually dropped, script will not replace)
  • Commands may need to be modified for your operating system (e.g., The default tar command in Solaris does not support compression)
  • Because the backup is done in stages enough temporary space must be available to build the backup files

Looking for support? Visit the forums, or join #drupal-support in IRC.