Backup (Stanford) AFS Drupal site shell script
Now with version 1.2!
This is a Bourne shell script for backing up a Drupal site installed in a Stanford AFS group or department account. (This version doesn't work anywhere else.)
It does a dump of the Drupal database and creates a compressed archive of the entire Drupal directory from which it is run. Both the directory archive and .sql file are written to a DrupalBackups directory under the top level directory of the department or group account from which it is run. (If the DrupalBackups directory doesn't already exist, it is created.)
To use:
- Download and expand backup-afs-drupal_v1_2.tar
- Using the command line:
- Using a terminal program (e.g., Terminal on a Mac or SecureCRT on a Windows computer), login to corn.stanford.edu
- Change directories (cd) to the cgi-bin directory (or a sub-directory thereof) where you want to install the script. Can be in a department, group, or personal account.
- At the prompt, type (all on one line):
curl http://SharonKrossa.com/sites/default/files/scripts/scripts/backup-afs-drupal_v1_2.tar | tar -vx
- At the prompt, type (all on one line):
chmod ug+x backup-afs-drupal.sh
- Without using the command line:
- Download backup-afs-drupal_v1_2.tar to your computer
- Upload backup-afs-drupal_v1_2.tar to a Stanford AFS account (can be a department, group, or personal account).
Note: File should be placed within a cgi-bin directory (or a sub-directory thereof), but does not need to be (and probably shouldn't be) within the Drupal directory to be backed up. - Expand backup-afs-drupal_v1_2.tar archive
- Confirm or change permissions so backup-afs-drupal.sh is executable (for user and group, not others)
- Using the command line:
- Using a terminal program (e.g., Terminal on a Mac or SecureCRT on a Windows computer), login to corn.stanford.edu
- Change directories (cd) to the main directory of the Drupal site you want to back up, for instance (substituting your path names for the generic ones here):
/afs/ir/group/mygroupname/cgi-bin/mydirectory/
(or for a department:/afs/ir/dept/mydeptname/cgi-bin/
mydirectory
)
- Run backup-afs-drupal.sh. At the prompt, type (with appropriate path):
/afs/ir/group/mygroupname/cgi-bin/scripts/backup-afs-drupal.sh
(or for a department:/afs/ir/dept/mydeptname/cgi-bin/scripts/backup-afs-drupal.sh)
- The script will ask for an (optional) extra label to use in the .sql and directory archive file names. If used, this label should contain alphanumeric, underscores, and hyphens only (for instance:
beforeupgrade-2010-09-01
). - Alternatively, the script can be run with an extra label entered as an argument. E.g., at the prompt, type (with appropriate path):
/afs/ir/group/mygroupname/cgi-bin/scripts/backup-afs-drupal.sh
somelabel
(or for a department:/afs/ir/dept/mydeptname/cgi-bin/scripts/backup-afs-drupal.sh
somelabel
)