This directory contains the "DreamHost Scripts Library", a set of bash shell scripts that assist in the management of a DreamHost web hosting account. Scripts assist in the setup of an environment suitable for the Drupal Script Library http://toddgee.com/drupalScripts Scripts are always available at http://svn.toddgee.com/dhScripts They may be checked out with the command: svn co "http://svn.toddgee.com/dhScripts" All scripts in this package copyright (C) 2008, 2009 Todd Gee (toddgee.com) Please see the included file COPYING for information on the GNU Public License, under which these scripts are made available to the public. Scripts written and maintained by Todd Gee (toddgee.com) If you find this script useful, please leave comment at http://toddgee.com/dhScripts For any feedback, please visit http://toddgee.com/contact -- Setup The package must be checked out into a subdirectory of the ~/bin directory. To facilitate these scripts you must copy/rename the file 'dhsetup.template.sh' to 'dhsetup.sh' in the same directory and update it to supply necessary constants. The dhsetup.sh script must be located in the same directory as the rest of the files in this package. See additional notes below attached to script descriptions for more setup information. -- Scripts - dreamhost.bashrc - dreamhost.bash_profile - dreamhost.bash_logout Replacements for the .bashrc, .bash_profile, .bash_logout scripts found in the home directory. Recommended usage is to remove these files, replacing them w/ symlinks to the checked-out versions. See: http://toddgee.com/node/34 The .bashrc replacement script will check for the presence of a '~/.bashrc.local' file and source it if found. This is a place to place local customizations. - backupDHUser.sh Performs a backup of a DH user's files to the backup directory '~/.backups' ($BACKUP_DIR), then rsync's that directory to the DH backup account. This rsync allows many user's data to be stored to one place so that offsite backups just have to duplicate the contents of the backup user's data rather than having to sync from multiple DH users. This script first backs up (via rsync) the users ~/bin directory to the $BACKUP_DIR. This rsync does not follow symlinks. This script will call another script 'makeLocalBackups.sh' if it exists in ~/bin or in a subdir. This can be used to back up additional information to the backup directory. E.g., this script could call the Drupal Scripts Library 'backup' script to backup all deployed Drupal sites: /drupalBackup.sh -archivemany ${BACKUP_DIR}/drupalSites all See below for a example header that can be used for this script. When the $BACKUP_DIR is rsynced over to the dreamhost backup, symlinks are followed. This allows backups to be made of other data directories just by creating symlinks to these directories from the $BACKUP_DIR To run the script via cron, add the following lines to your crontab (via 'crontab -e'): # Standard backup call @midnight /backupDHUser.sh - fixSlave.sh Sets up a 'web' user's bash files and bin dir as described here: http://toddgee.com/node/35 - setupUserPair.sh A script to setup a user/web pair of users in accordance with the 'best practice' described here: http://toddgee.com/node/5 Run script w/o parameters for script usage. Script was originally intended to create the users before setup; but DreamHost's API does not provide for user creation so users must be pre-created as per the script header. -- Example 'makeLocalBackups.sh' script header. Here is an example of a standard header that can be used for the 'makeLocalBackups.sh' script for a DH user. This script is called by the 'backupDHUser.sh' script as described above. ----- Begin Include #!/bin/bash # backup this user's stuff # # Constants defined by calling script: # USER - username # HOME - home dir # BIN - user's bin directory # BACKUP_DIR - user's private backup dir = $HOME/$USER.backups ----- End Include