Created
November 12, 2011 23:33
-
-
Save dux/1361289 to your computer and use it in GitHub Desktop.
MYSQL database push to remote server
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="${1}.sql" | |
rm -rf $FILE | |
echo "Database dump to [${FILE}]" | |
mysqldump -u root $1 > $FILE | |
echo "Deleting remote database" | |
ssh [email protected] "rm -rf /var/www/${FILE}" | |
echo "Database backup upload" | |
scp $FILE [email protected]:/var/www | |
echo "Remote backup import" | |
ssh [email protected] "mysql --user=root --password=XYZ ${1} < /var/www/${FILE}" | |
echo "Restart NGINX engine" | |
ssh [email protected] "/root/batch/restartx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment