Skip to content

Instantly share code, notes, and snippets.

@paulsheldrake
Created June 28, 2017 19:17
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 paulsheldrake/f857d394795d1c2d2fd66680e2e45891 to your computer and use it in GitHub Desktop.
Save paulsheldrake/f857d394795d1c2d2fd66680e2e45891 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Generate the new dump file path
now=$(date +"%Y_%m_%d")
path="/home/468e/backup/mises.prod.$now.sql"
path_gz="/home/468e/backup/mises.prod.$now.sql.gz"
# Export the DB, remove old versions of the same file
rm -f $path_gz
cd /var/www/prod.mises.org/htdocs/;
/usr/local/bin/drush sql-dump --gzip --result-file="$path";
# Create symlink to latest
path_latest="/home/468e/backup/latest.sql.gz"
rm -f $path_latest
ln -s $path_gz $path_latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment