Last active
August 29, 2015 14:01
-
-
Save rafaelstz/922c5b9cdf63ec50a154 to your computer and use it in GitHub Desktop.
Backup do Banco via ShellScript
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
# | |
# script by [email protected] | |
# | |
echo "Digite seu dns"; | |
read host; | |
echo "Digite seu user"; | |
read user; | |
echo "Digite seu pass"; | |
stty -echo | |
read pass; | |
echo "Digite a base que deseja executar o backup"; | |
stty echo | |
read base; | |
echo "Voce deseja [I]mportar ou [E]xportar"; | |
read typi; | |
if [ $typi = "E" ] | |
then | |
mysqldump -h $host -u $user -p$pass $base > $base"_backup.sql"; | |
if [ -e $base"_backup.sql" ] | |
then | |
echo "Seu arquivo foi criado com sucesso em: " `pwd`"/"$base"_backup.sql"; | |
else | |
echo "Houve algum problema"; | |
fi | |
else | |
echo "Digite o caminho completo do seu aquivo SQL"; | |
read filename; | |
if [ -e $filename ] | |
then | |
mysql -h $host -u $user -p$pass $base < $filename; | |
echo "Import efetuado com sucesso"; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment