summaryrefslogtreecommitdiff
path: root/packaging/docker/catlfish-merge/merge.sh
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-04-01 22:14:13 +0200
committerLinus Nordberg <linus@nordberg.se>2015-04-03 16:48:59 +0200
commit352ade3dfb4890c40f17ebff2cfc55c21e8de20e (patch)
treecf5b10685c93a6c6471eda3e55e40d5b7ea60885 /packaging/docker/catlfish-merge/merge.sh
parent4860fff216892010a997547b0fa19cd4505cb804 (diff)
[Docker] Add docker support for merge nodes.
Also, run as a separate user in docker-dev.
Diffstat (limited to 'packaging/docker/catlfish-merge/merge.sh')
-rwxr-xr-xpackaging/docker/catlfish-merge/merge.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/packaging/docker/catlfish-merge/merge.sh b/packaging/docker/catlfish-merge/merge.sh
new file mode 100755
index 0000000..b3658cd
--- /dev/null
+++ b/packaging/docker/catlfish-merge/merge.sh
@@ -0,0 +1,27 @@
+#! /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
+
+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