Skip to content

Instantly share code, notes, and snippets.

@dannygsmith
Last active October 3, 2017 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannygsmith/38c2c7b5d36f4247bf7eb7bff3c0f1c1 to your computer and use it in GitHub Desktop.
Save dannygsmith/38c2c7b5d36f4247bf7eb7bff3c0f1c1 to your computer and use it in GitHub Desktop.
backup all valet-plus databases
#!/usr/bin/env bash
export PATH="/usr/local/bin:$PATH";
SUFFIX=`date "+%w"`
readarray arr < /Users/riskiii/bin/hosts.txt
## now loop through the above array
for k in "${arr[@]}"
do
printf -v x "%s%s-%s.sql" "/Users/riskiii/Dropbox/backups/" $k $SUFFIX
/usr/local/bin/mysqldump --defaults-file="/Users/riskiii/bin/my.txt" \
--add-drop-table $k \
> $x 2>/dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment