Created
November 13, 2011 00:04
-
-
Save dux/1361327 to your computer and use it in GitHub Desktop.
MYSQL database pull from remote server (heroku like)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE="/var/www/${1}.sql" | |
echo "Delete remote dump [${FILE}]" | |
ssh [email protected] "rm -rf ${FILE}" | |
echo "Remote database dump" | |
ssh [email protected] "mysqldump --user=root --password=XYZ ${1} > ${FILE}" | |
# echo "Deleting local backup" | |
# rm -rf "${1}.sql" | |
echo "Backup download" | |
scp "[email protected]:${FILE}" . | |
echo "Backup import" | |
mysql --user=root $1 < "${1}.sql" | |
echo "Finito!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment