Created
August 10, 2017 22:03
-
-
Save felipefernandes/30ad618f29bf62d75e3b6a7124c548c8 to your computer and use it in GitHub Desktop.
Docker Database Dump Import Shell Script
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 | |
# | |
# version 1.0 | |
# Docker WP Dump Loader | |
# | |
echo "Starting up..." | |
echo "" | |
# | |
echo "What's the docker mysql container name?" | |
read containerName | |
if [ "$containerName" == "" ]; then | |
echo "Sorry, you need to inform the Container name!" | |
exit | |
else | |
echo "Database dump filename?" | |
read dumpfile | |
if [ "$containerName" == "" ]; then | |
echo "Sorry, you need to inform the Container name!" | |
exit | |
else | |
echo "" | |
echo "Loads saved database dump ($dumpfile) into MySQL container ($containerName)" | |
echo "------------------------------------------------------" | |
echo "" | |
# Loads and imports a local dump file inside the mysql container | |
docker exec -i $containerName mysql wordpress -uroot -pwp < $dumpfile 2>/dev/null | |
echo "" | |
echo "High Five!!!" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment