forked from kamba4/sunders
improved performance
All checks were successful
Build (and tag) Images / build (push) Successful in 38s
All checks were successful
Build (and tag) Images / build (push) Successful in 38s
This commit is contained in:
parent
6c8f5cce81
commit
8612798373
3 changed files with 58 additions and 97 deletions
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
exeDir=$(cd "$(dirname "$0")"; pwd)
|
||||
cd "$exeDir"
|
||||
|
||||
REPLICATE_URL=$(grep -oP "REPLICATE_URL[',\s]*['\"]\Khttps?://[^'\"]+" config.php)
|
||||
|
||||
echo "Using replicate URL: $REPLICATE_URL"
|
||||
export REPLICATE_URL
|
||||
|
||||
|
||||
lastSeqNum=$(php get_sync_state.php)
|
||||
curl -sL "$REPLICATE_URL/state.txt" -o state.txt
|
||||
newSeqNum=$(grep "^sequenceNumber=" "state.txt" | cut -d'=' -f2-)
|
||||
echo $newSeqNum
|
||||
if [ "$newSeqNum" -eq "$lastSeqNum" ]; then
|
||||
echo "No new file to be processed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p logs
|
||||
seq "$((lastSeqNum + 1))" "$newSeqNum" > seq_list.txt
|
||||
|
||||
|
||||
cat seq_list.txt | xargs -n1 -P7 -I{} bash -c '
|
||||
seqnum="$1"
|
||||
f=$(printf "%09d" "$seqnum")
|
||||
path=$(echo "$f" | sed -E "s#(...)(...)(...)#\1/\2/\3#")
|
||||
url="${REPLICATE_URL}/${path}.osc.gz"
|
||||
echo "Downloading $url"
|
||||
curl -sL "$url" -o "${seqnum}.osc.gz" && gunzip "${seqnum}.osc.gz"
|
||||
' _ {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue