I must admit, updating a Drupal instance, even if it’s one module is a bit scary. And a rule of thumb is: backup, backup and backup the backup. So I do it.
Below I post a script that I wrote for that purpose (my first script for Linux :D). The folder structure on my server is:
~/ ~/files/ ~/public_html/drupal-6.x/
The Script
today=$(date +"%Y-%m-%d") drupal_v="6.6" backups="files" cd ~/ mkdir $backups/$today clear echo -e "TODAY: $today\n" # 1. echo "---Backing up Drupal 6.x without uploaded files---" tar --create --gzip --file=$backups/$today/drupal-$drupal_v-no-files.tgz --exclude='sites/default/files' \ --directory=public_html drupal-6.x echo -e "DONE\n" # 2. echo "---Backing up Drupal 6.x uploaded files---" tar --create --gzip --file=$backups/$today/files.tgz --directory=public_html/drupal-6.x/sites/default files echo -e "DONE\n" #3. echo "---Dumping the database---" /usr/local/mysql/bin/mysqldump -u YOU -p --default-character-set=utf8 --result-file=$backups/$today/dump.sql DB tar --create --gzip --file=$backups/$today/dump.sql.tgz --directory=$backups/$today dump.sql echo -e "DONE\n" #4. echo "---Copying the settings---" cp public_html/drupal-6.x/sites/default/settings.php public_html/drupal-6.x/.htaccess $backups/$today echo -e "DONE\n" #5. echo "FINISHED. Please move the backup files to a safe location"


