Created
January 25, 2013 12:04
-
-
Save blu3Alien/4633929 to your computer and use it in GitHub Desktop.
Shell script to restore a supplied compressed mySQL backup.
Note: update username and password before using.
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/sh | |
doContinue=n | |
echo -n "Do you really want to continue? [y/n] " | |
read doContinue | |
if [ "$doContinue" != "y" ]; then | |
echo "Quitting..." | |
exit | |
fi | |
if [ ! -r $1 ]; then #file not found or readable | |
echo "File $1 does not exist or is not readable." | |
exit | |
fi | |
gunzip < $1 | mysql --user=[username] --password=[password] | |
echo "Databases restored from $1." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment