From 20384de0ef6cd5a578bc0531a40e8ace3fa8c569 Mon Sep 17 00:00:00 2001 From: Feng Date: Tue, 25 Aug 2015 23:37:13 +0800 Subject: [PATCH] fix issue #257 --- rel/files/emqttd | 6 ++++++ rel/files/vm.args | 5 ----- rel/reltool.config | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rel/files/emqttd b/rel/files/emqttd index 8574571c1..6afa2a08b 100755 --- a/rel/files/emqttd +++ b/rel/files/emqttd @@ -20,6 +20,7 @@ RUNNER_BASE_DIR={{runner_base_dir}} RUNNER_ETC_DIR={{runner_etc_dir}} RUNNER_LIB_DIR={{platform_lib_dir}} RUNNER_LOG_DIR={{runner_log_dir}} +RUNNER_DATA_DIR=$RUNNER_BASE_DIR/data RUNNER_PLUGINS_DIR=$RUNNER_BASE_DIR/plugins # Note the trailing slash on $PIPE_DIR/ @@ -72,6 +73,8 @@ if [ -z "$NAME_ARG" ]; then echo "vm.args needs to have either -name or -sname parameter." exit 1 fi +NAME_ARR=(${NAME_ARG// / }) +NODE_NAME=${NAME_ARR[1]} # Extract the target cookie COOKIE_ARG=`grep '^\-setcookie' $RUNNER_ETC_DIR/vm.args` @@ -264,9 +267,12 @@ case "$1" in BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin EMU=beam PROGNAME=`echo $0 | sed 's/.*\///'` + # Setup Mnesia Dir + MNESIA_DIR="$RUNNER_DATA_DIR/mnesia/$NODE_NAME" CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$SCRIPT \ -embedded -config $RUNNER_ETC_DIR/emqttd.config \ -pa $RUNNER_LIB_DIR/basho-patches \ + -mnesia dir "\"${MNESIA_DIR}\"" \ -args_file $RUNNER_ETC_DIR/vm.args -- ${1+"$@"}" export EMU export ROOTDIR diff --git a/rel/files/vm.args b/rel/files/vm.args index 0f3894c92..39fb4c708 100644 --- a/rel/files/vm.args +++ b/rel/files/vm.args @@ -6,11 +6,6 @@ ## Cookie for distributed erlang -setcookie emqttdsecretcookie -##------------------------------------------------------------------------- -## Mnesia dir. NOTICE: quote the dir with '" "' -##------------------------------------------------------------------------- --mnesia dir '"data/mnesia"' - ##------------------------------------------------------------------------- ## Flags ##------------------------------------------------------------------------- diff --git a/rel/reltool.config b/rel/reltool.config index 72dfede6e..e5c75902e 100644 --- a/rel/reltool.config +++ b/rel/reltool.config @@ -73,6 +73,7 @@ {mkdir, "etc/"}, {mkdir, "etc/ssl/"}, {mkdir, "data/"}, + {mkdir, "data/mnesia"}, {mkdir, "plugins/"}, {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, {template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},