blob: 4120ec26b78b4fe45b55fce79d92bd262cba4069 (
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
30
31
32
33
|
#! /bin/sh
LOGNAME=$1
NODENAME=$2
[ -z "$LOGNAME" ] && LOGNAME=catlfish
[ -z "$NODENAME" ] && NODENAME=merge
[ -z "$MERGE_DB_DIR" ] && MERGE_DB_DIR=merge-db
[ -z "$MERGE_INTERVAL_FIRST" ] && MERGE_INTERVAL_FIRST=60
[ -z "$MERGE_INTERVAL_FREQ" ] && MERGE_INTERVAL_FREQ=3600
[ -d $MERGE_DB_DIR ] || mkdir $MERGE_DB_DIR
[ -d $MERGE_DB_DIR/chains ] || mkdir $MERGE_DB_DIR/chains
[ -e $MERGE_DB_DIR/logorder ] || touch $MERGE_DB_DIR/logorder
S1=$MERGE_INTERVAL_FIRST
S2=$MERGE_INTERVAL_FREQ
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/${LOGNAME}.cfg \
--localconfig /usr/local/etc/catlfish/${NODENAME}.cfg \
${MERGE_EXTRA_ARGS}
date
echo "merge: waiting $(expr $S2 / 60)m$(expr $S2 % 60)s before merging again"
sleep $S2
done
|