summaryrefslogtreecommitdiff
path: root/dumps/fetch-local.sh
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2023-10-08 00:02:38 +0200
committeremkael <emkael@tlen.pl>2023-10-08 00:02:38 +0200
commitdd5eb8b2b9fd0f46e0df14ca2f0bf56991ab5a62 (patch)
treea85cc1d09800240242f19602d9d3ca4ab3c05fa0 /dumps/fetch-local.sh
parent7e71262ba4b5ffbec3cded250e64e90c009aa8a8 (diff)
Documentation and configuration for local SQL dumps
Diffstat (limited to 'dumps/fetch-local.sh')
-rwxr-xr-xdumps/fetch-local.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/dumps/fetch-local.sh b/dumps/fetch-local.sh
index 01616a7..2dccc83 100755
--- a/dumps/fetch-local.sh
+++ b/dumps/fetch-local.sh
@@ -1,9 +1,15 @@
#!/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
+if [ -z ${LIGA_LOCAL_DUMP_PATTERN+x} ]
+then
+ echo 'Local dumps not configured, skipping'
+else
+ find ${LIGA_LOCAL_DUMP_PATH} -path ${LIGA_LOCAL_DUMP_PATTERN} | 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
+ echo "${LOCAL_DUMP}"
+ done
+fi