Created
August 8, 2016 11:06
-
-
Save alexislefebvre/0b2d93b2c78a064b49a6c912deff5ab8 to your computer and use it in GitHub Desktop.
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 | |
# See http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/23905052#23905052 | |
ROOT=$(readlink -f $(dirname "$0")) | |
cd $ROOT | |
# Get database parameters | |
dbname=$(grep "database_name" ./app/config/parameters.yml | cut -d " " -f 6) | |
dbuser=$(grep "database_user" ./app/config/parameters.yml | cut -d " " -f 6) | |
dbpassword=$(grep "database_password" ./app/config/parameters.yml | cut -d " " -f 6) | |
filename="$(date '+%Y-%m-%d_%H-%M-%S').sql" | |
echo "Export $dbname database" | |
mysqldump -B "$dbname" -u "$dbuser" --password="$dbpassword" > "$filename" | |
echo "Output file :" | |
ls -lh "$filename" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wget -O - http://foo.bar/pathToScript.sh | bash