Skip to content

Instantly share code, notes, and snippets.

@skyred
Last active December 10, 2015 04:08
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/4378911 to your computer and use it in GitHub Desktop.
Save skyred/4378911 to your computer and use it in GitHub Desktop.
Drupal files and database backup script
#!/bin/sh
#Set information specific to your site
webroot="/srv/www/example.com"
db_user="example.com"
db_password="XXXXXXXXXXXXXXXX"
db_name="example.com"
#Set the date and name for the backup files
date=`date '+%A'`
#Dump the mysql database
mysqldump -u $db_user --password="$db_password" $db_name > $webroot/backups/db_backup_$date.sql
#Backup Site
env GZIP=-9 tar -czpf backups/site_backup_$date.tar.gz public_html/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment