summaryrefslogtreecommitdiff
path: root/catlfish-dev/merge.sh
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-05-26 15:18:54 +0200
committerLinus Nordberg <linus@nordberg.se>2015-05-26 15:18:54 +0200
commita8126b37d4ef973092c1adf4d8238509de21542b (patch)
tree3c3ba32ac71e3df7c3744e3ac84a21be3ec344b2 /catlfish-dev/merge.sh
Initial commit.
Diffstat (limited to 'catlfish-dev/merge.sh')
-rwxr-xr-xcatlfish-dev/merge.sh32
1 files changed, 32 insertions, 0 deletions
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