From a6ca0fa635e3a3816f9f11d529f22f4896b3bae7 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 7 Oct 2023 21:23:45 +0200 Subject: Importing dumps uploaded via Dropbox and FTP --- .envrc | Bin 971 -> 1028 bytes Makefile | 6 ++++-- dumps/fetch-dropbox.sh | 3 +++ dumps/fetch-local.sh | 9 +++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 dumps/fetch-dropbox.sh create mode 100755 dumps/fetch-local.sh diff --git a/.envrc b/.envrc index 659e50c..82725f3 100644 Binary files a/.envrc and b/.envrc differ diff --git a/Makefile b/Makefile index d1b4582..45e59f1 100644 --- a/Makefile +++ b/Makefile @@ -29,13 +29,15 @@ backups: FORCE s3cmd -c dumps/.s3config --exclude="*/*" sync dumps/backup/ ${LIGA_S3_BACKUP_BUCKET} dumps: FORCE - s3cmd -c dumps/.s3config --exclude="*/*" sync ${LIGA_S3_BUCKET} dumps/sync/ + s3cmd -c dumps/.s3config --exclude="*/*" sync ${LIGA_S3_BUCKET} ./dumps/sync/ + ./dumps/fetch-dropbox.sh + ./dumps/fetch-local.sh ./dumps/load-dumps.sh butler: FORCE - python butler/butler.py 1+2 | mysql ${LIGA_MYSQL_CONNECTION_OPTS} python butler/butler.py 1 | mysql ${LIGA_MYSQL_CONNECTION_OPTS} python butler/butler.py 2 | mysql ${LIGA_MYSQL_CONNECTION_OPTS} + python butler/butler.py 1+2 | mysql ${LIGA_MYSQL_CONNECTION_OPTS} ausbutler: FORCE ./ausbutler/ausbutler-all.sh diff --git a/dumps/fetch-dropbox.sh b/dumps/fetch-dropbox.sh new file mode 100755 index 0000000..99db29e --- /dev/null +++ b/dumps/fetch-dropbox.sh @@ -0,0 +1,3 @@ +#!/bin/bash +dbxcli ls -l "${LIGA_DROPBOX_DUMP_FOLDER}" | awk -F"ago" '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | + xargs -I{} dbxcli get {} dumps/sync diff --git a/dumps/fetch-local.sh b/dumps/fetch-local.sh new file mode 100755 index 0000000..01616a7 --- /dev/null +++ b/dumps/fetch-local.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +find http -path */spedytor/*.sql | sort | uniq | cut -d/ -f 1-4 | uniq | while read LOCAL_DUMP_DIR +do + LOCAL_DUMP=$(find ${LOCAL_DUMP_DIR} -name *.sql -exec ls -t1 {} + | head -n1 | cut -d' ' -f 10) + TARGET_DUMP=$(basename ${LOCAL_DUMP}) + TARGET_DUMP=${TARGET_DUMP%%-*} + cp "${LOCAL_DUMP}" dumps/sync/${TARGET_DUMP}.sql +done -- cgit v1.2.3