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 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 root@178.79.163.176 "rm -rf /var/www/${FILE}" | |
echo "Database backup upload" | |
scp $FILE root@178.79.163.176:/var/www | |
echo "Remote backup import" | |
ssh root@178.79.163.176 "mysql --user=root --password=XYZ ${1} < /var/www/${FILE}" | |
echo "Restart NGINX engine" | |
ssh root@178.79.163.176 "/root/batch/restartx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment