#! /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