Created
January 15, 2014 12:23
Revisions
-
jalal created this gist
Jan 15, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/bin/bash # [email protected] REMOTEDB=usrdb_name REMOTEUSER=usrdb_username REMOTEPASS=secretpassword LOCALDB=$REMOTEDB LOCALUSER= LOCALPASS= LOCAL1=$REMOTEDB-`date +"%Y%m%d"`.sql echo Dumping data from $REMOTEDB to local file $LOCAL1 ssh $SSHSTR mysqldump --opt --user=$REMOTEUSER --password=$REMOTEPASS $REMOTEDB > $LOCAL1 echo "Importing to local MySQL database $LOCAL1" echo while true; do read -p "Do you want to install the data into the database? [y/n]" yn case $yn in [Yy]* ) mysql -u $LOCALUSER -p$LOCALPASS $LOCALDB < $LOCAL1;break;; [Nn]* ) exit;; esac done echo Done!