diff options
author | emkael <emkael@tlen.pl> | 2020-10-08 22:28:09 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2020-10-08 22:28:09 +0200 |
commit | d0f4f64a6f946d56a5a7304eb07edda66e725b4b (patch) | |
tree | b048cc1016590d82a388084aae93bd1a14a89dfb /dumps/load-dumps.sh | |
parent | 47c8a3673dcb46436f0ddebe9a417af6cd601416 (diff) |
Database dump pull script (S3 -> MySQL)
Diffstat (limited to 'dumps/load-dumps.sh')
-rwxr-xr-x | dumps/load-dumps.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/dumps/load-dumps.sh b/dumps/load-dumps.sh new file mode 100755 index 0000000..7695a40 --- /dev/null +++ b/dumps/load-dumps.sh @@ -0,0 +1,17 @@ +#!/bin/bash +pushd $(dirname $0) >> /dev/null +cat .mapping | while read DB DUMP +do + grep -v 'CREATE DATABASE' $DUMP | grep -vi '^Use ' | mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB + if [ "$DB" != "dmp202021_e" ] + then + <logoh.sql mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB + else + <logoh.en.sql mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DB + fi + cat .queries | while read -r QUERY + do + mysql ${LIGA_MYSQL_CONNECTION_OPTS} -N -e "$QUERY" $DB + done +done +popd >> /dev/null |