From 82887747877175e354bb8f9538ea2b31db6d7c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Sautret?= Date: Tue, 18 Jul 2023 15:31:10 +0200 Subject: [PATCH] Add EJABBERD_OPTS in ejabberdctl.cfg & revert "Improve ejabberdctl script" EJABBERD_OPTS is used to pass options to erl only when starting ejabberd, to enable -heart for example. This partially reverts commit 6272c0e9011a6b866277f1ceee73d909a39cb61d. --- ejabberdctl.cfg.example | 19 +++++++++++++++---- ejabberdctl.template | 8 ++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ejabberdctl.cfg.example b/ejabberdctl.cfg.example index 8b15933db..da9e1bd32 100644 --- a/ejabberdctl.cfg.example +++ b/ejabberdctl.cfg.example @@ -108,10 +108,8 @@ #. #' ERL_OPTIONS: Additional Erlang options # -# The next variable allows to specify additional options passed to erlang while -# starting ejabberd. Some useful options are -noshell, -detached, -heart. When -# ejabberd is started from an init.d script options -noshell and -detached are -# added implicitly. See erl(1) for more info. +# The next variable allows to specify additional options passed to +# erlang. See erl(1) for more info. # # It might be useful to add "-pa /usr/local/lib/ejabberd/ebin" if you # want to add local modules in this path. @@ -120,6 +118,19 @@ # #ERL_OPTIONS="" +#. +#' EJABBERD_OPTS: Additional Erlang options to start ejabberd +# +# The next variable allows to specify additional options passed to erlang while +# starting ejabberd. Some useful options are -noshell, -detached, -heart. When +# ejabberd is started from an init.d script options -noshell and -detached are +# added implicitly. See erl(1) for more info. +# +# Default: "" +# +#EJABBERD_OPTS="" +EJABBERD_OPTS="-heart -env HEART_BEAT_TIMEOUT 120 -env ERL_CRASH_DUMP_SECONDS 60" + #. #' ERLANG_NODE: Erlang node name # diff --git a/ejabberdctl.template b/ejabberdctl.template index a549b9393..4085492ac 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -95,7 +95,7 @@ $(sed '/^log_rotate_count/!d;s/:[ \t]*\([0-9]*\).*/ \1/;s/^/ /' "$EJABBERD_CONFI $(sed '/^log_burst_limit_count/!d;s/:[ \t]*\([0-9]*\).*/ \1/;s/^/ /' "$EJABBERD_CONFIG_PATH")\ $(sed '/^log_burst_limit_window_time/!d;s/:[ \t]*\([0-9]*[a-z]*\).*/ \1/;s/^/ /' "$EJABBERD_CONFIG_PATH")" [ -n "$EJABBERD_OPTS" ] && EJABBERD_OPTS="-ejabberd $EJABBERD_OPTS" -EJABBERD_OPTS="$ERLANG_OPTS -mnesia dir \"$SPOOL_DIR\" $MNESIA_OPTIONS $EJABBERD_OPTS -s ejabberd" +EJABBERD_OPTS="-mnesia dir \"$SPOOL_DIR\" $MNESIA_OPTIONS $EJABBERD_OPTS -s ejabberd" # export global variables export EJABBERD_CONFIG_PATH @@ -128,12 +128,12 @@ exec_cmd() exec_erl() { NODE=$1; shift - exec_cmd "$ERL" ${S:--}name "$NODE" "$@" + exec_cmd "$ERL" ${S:--}name "$NODE" $ERLANG_OPTS "$@" } exec_iex() { NODE=$1; shift - exec_cmd "$IEX" -${S:--}name "$NODE" "$@" + exec_cmd "$IEX" -${S:--}name "$NODE" --erl "$ERLANG_OPTS" "$@" } # usage @@ -321,7 +321,7 @@ case $1 in PEER=${2:-$ERLANG_NODE} [ "$PEER" = "${PEER%.*}" ] && PS="-s" set_dist_client - exec_cmd "$ERL" ${PS:--}name "$(uid ping "$(hostname $PS)")" \ + exec_cmd "$ERL" ${PS:--}name "$(uid ping "$(hostname $PS)")" $ERLANG_OPTS \ -noinput -hidden -eval 'io:format("~p~n",[net_adm:ping('"'$PEER'"')])' \ -s erlang halt -output text ;;