Skip to content

Instantly share code, notes, and snippets.

@skyred
Last active May 25, 2016 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyred/aa5949172b3b759bf7e39f5813f0f416 to your computer and use it in GitHub Desktop.
Save skyred/aa5949172b3b759bf7e39f5813f0f416 to your computer and use it in GitHub Desktop.
Drupal backup script, using Drush
#!/bin/sh
#Set information specific to your site
webroot="/var/www/html/"
#Set the date and name for the backup files
date=`date '+%A'`
#Dump the mysql database
cd $webroot/public_html
#Drush needs addtional path in the cron
export PATH=$PATH:/usr/local/bin
drush cr
drush sql-dump --gzip --result-file=../backups/db_backup_$date.sql
echo 'Backup has finished for' `date` '!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment