From a8126b37d4ef973092c1adf4d8238509de21542b Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 26 May 2015 15:18:54 +0200 Subject: Initial commit. --- catlfish-dev/merge.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 catlfish-dev/merge.sh (limited to 'catlfish-dev/merge.sh') diff --git a/catlfish-dev/merge.sh b/catlfish-dev/merge.sh new file mode 100755 index 0000000..9ca4d69 --- /dev/null +++ b/catlfish-dev/merge.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +LOGNAME=$1 +NODENAME=$3 + +[ -z "$NODENAME" ] && NODENAME=merge +[ -z "$LOGNAME" ] && LOGNAME=catlfish +[ -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 + date + echo "merge: waiting $(expr $S2 / 60)m$(expr $S2 % 60)s before merging again" + sleep $S2 +done -- cgit v1.1