-
-
Save narwanimonish/d64d8d018b9fb69806469f35ca8b6817 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 | |
# declare an array called array and define 3 vales | |
databases=( drupal fresh lasalle_wp_fts ) | |
username=root | |
password=password | |
filepath=/home/amitavroy/code/backup | |
for i in "${databases[@]}" | |
do | |
filename=${i}_$(date +"%m%d%Y-%k%M") | |
mysqldump -u${username} -p${password} ${i} > ${filepath}/${filename}.sql | |
tar -zcf ${filepath}/${filename}.tar.gz ${filepath}/${filename}.sql | |
rm ${filepath}/${filename}.sql | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment