summaryrefslogtreecommitdiff
path: root/packaging/docker/catlfish-dev/merge.sh
blob: 304d8a488b18d9b8c3d0d2aac94ef612fa2262a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/sh

# Default intervals
# - 5m before first merge
# - 20m between subsequent merges
S1=300; [ -n "$1" ] && S1=$1
S2=1200; [ -n "$2" ] && S2=$2

DBDIR="$3"

[ -d $DBDIR ] || mkdir $DBDIR
[ -d $DBDIR/chains ] || mkdir $DBDIR/chains
[ -e $DBDIR/logorder ] || touch $DBDIR/logorder

echo "merge: ERL_LIBS: $ERL_LIBS"

date
echo "merge: waiting $(expr $S1 / 60)m$(expr $S1 % 60)s before merging for the first time"
sleep $S1

while true; do
    echo "$0: merging"
    date
    python /usr/local/src/catlfish/tools/merge.py \
           --config /usr/local/etc/catlfish/system.cfg \
           --localconfig /usr/local/etc/catlfish/merge.cfg
    echo "merge: waiting $(expr $S2 / 60)m$(expr $S2 % 60)s before merging again"
    sleep $S2
done