blob: 3a982fbeffcd8bcb2324dffa253e2631f4983dc7 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#! /bin/sh
# Required arguments.
logname=$1; [ -n "$1" ] && shift
role=$1; [ -n "$1" ] && shift
nodename=$1; [ -n "$1" ] && shift
# Optional arguments.
database=$CATLFISH_DB_DIR
erlbase=$ERLANG_BASE_DIR
# Use some reasonable default values.
[ -z "$database" ] && database=/var/db/catlfish-merge
[ -z "$erlbase" ] && erlbase=/usr/local/catlfish
# FIXME: Get compileconfig.py from the
# $erlbase/lib/catlfish-$VERSION.ez (zip archive) instead of requiring
# source code to be unpacked in the container.
COMPILECONFIG=/usr/local/src/catlfish/tools/compileconfig.py
case $role in
frontend|storage|signing)
if ! [ -f ${nodename}.config ]; then
$COMPILECONFIG --config ${logname}.cfg \
--localconfig ${nodename}.cfg;
fi
$erlbase/bin/run_erl \
/var/run/catlfish/ \
/var/run/catlfish/erlang_log/ \
"exec $erlbase/bin/erl -config $nodename"
;;
merge)
# Catlfish version is included in filename of archive and
# filename in that archive. Example: lib/catlfish-0.6.0.ez
# contains catlfish-0.6.0.
ver=$(ls $erlbase/lib/catlfish-*.ez | sed 's/.*catlfish-\(.*\)\.ez/\1/1')
ERL_LIBS=$erlbase/lib/catlfish-${ver}.ez/catlfish-${ver}
ERL_LIBS=$ERL_LIBS:$erlbase/lib/lager-2.1.1.ez/lager-2.1.1
export ERL_LIBS
export MERGE_INTERVAL_FIRST=60
export MERGE_INTERVAL_FREQ=3600
export MERGE_DB_DIR=$database
$erlbase/merge.sh $logname $nodename \
> merge_log/stdout \
2> merge_log/stderr
;;
*)
echo "catlfish: unknown role: $role"
;;
esac
|