Instantly share code, notes, and snippets.

Embed
What would you like to do?
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