22
33# define default configuration
44POLL=true
5- SMP=enable
65ERL_MAX_PORTS=32000
76ERL_PROCESSES=250000
87ERL_MAX_ETS_TABLES=1400
@@ -95,9 +94,12 @@ ERL_CRASH_DUMP="$LOGS_DIR"/erl_crash_$(date "+%Y%m%d-%H%M%S").dump
9594ERL_INETRC=" $ETC_DIR " /inetrc
9695
9796# define ejabberd parameters
98- EJABBERD_OPTS=" $EJABBERD_OPTS \
99- $( sed ' /^log_rotate_size/!d;s/:[ \t]*\([0-9]\{1,\}\).*/ \1/;s/:[ \t]*\(infinity\).*/ \1/;s/^/ /' " $EJABBERD_CONFIG_PATH " ) \
100- $( sed ' /^log_rotate_count/!d;s/:[ \t]*\([0-9]*\).*/ \1/;s/^/ /' " $EJABBERD_CONFIG_PATH " ) "
97+ EJABBERD_OPTS=" \
98+ $( sed ' /^log_rotate_size/!d;s/:[ \t]*\([0-9]\{1,\}\).*/ \1/;s/:[ \t]*\(infinity\).*/ \1 /;s/^/ /' " $EJABBERD_CONFIG_PATH " ) \
99+ $( sed ' /^log_rotate_count/!d;s/:[ \t]*\([0-9]*\).*/ \1 /;s/^/ /' " $EJABBERD_CONFIG_PATH " ) \
100+ $( sed ' /^log_burst_limit_count/!d;s/:[ \t]*\([0-9]*\).*/ \1 /;s/^/ /' " $EJABBERD_CONFIG_PATH " ) \
101+ $( sed ' /^log_burst_limit_window_time/!d;s/:[ \t]*\([0-9]*[a-z]*\).*/ \1 /;s/^/ /' " $EJABBERD_CONFIG_PATH " ) \
102+ $EJABBERD_OPTS "
101103[ -n " $EJABBERD_OPTS " ] && EJABBERD_OPTS=" -ejabberd $EJABBERD_OPTS "
102104EJABBERD_OPTS=" -mnesia dir \" $SPOOL_DIR \" $MNESIA_OPTIONS $EJABBERD_OPTS -s ejabberd"
103105
@@ -148,14 +150,6 @@ exec_iex()
148150# usage
149151debugwarning ()
150152{
151- if [ " $OSTYPE " != " cygwin" ] && [ " $OSTYPE " != " win32" ] ; then
152- if [ " a$TERM " = " a" ] || [ " $TERM " = " dumb" ] ; then
153- echo " Terminal type not supported."
154- echo " You may have to set the TERM environment variable to fix this."
155- exit 8
156- fi
157- fi
158-
159153 if [ " $EJABBERD_BYPASS_WARNINGS " != " true" ] ; then
160154 echo " --------------------------------------------------------------------"
161155 echo " "
@@ -169,11 +163,13 @@ debugwarning()
169163 echo " To exit and detach this shell from ejabberd, press:"
170164 echo " control+g and then q"
171165 echo " "
166+ # vt100 echo "Please do NOT use control+c in this debug shell !"
167+ # vt100 echo ""
172168 echo " --------------------------------------------------------------------"
173169 echo " To bypass permanently this warning, add to ejabberdctl.cfg the line:"
174170 echo " EJABBERD_BYPASS_WARNINGS=true"
175171 echo " Press return to continue"
176- read -r input
172+ read -r _
177173 echo " "
178174 fi
179175}
@@ -196,8 +192,41 @@ livewarning()
196192 echo " To bypass permanently this warning, add to ejabberdctl.cfg the line:"
197193 echo " EJABBERD_BYPASS_WARNINGS=true"
198194 echo " Press return to continue"
199- read -r input
195+ read -r _
196+ echo " "
197+ fi
198+ }
199+
200+ check_etop_result ()
201+ {
202+ result=$?
203+ if [ $result -eq 1 ] ; then
200204 echo " "
205+ echo " It seems there was some problem running 'ejabberdctl etop'."
206+ echo " Is the error message something like this?"
207+ echo " Failed to load module 'etop' because it cannot be found..."
208+ echo " Then probably ejabberd was compiled with development tools disabled."
209+ echo " To use 'etop', recompile ejabberd with: ./configure --enable-tools"
210+ echo " "
211+ exit $result
212+ fi
213+ }
214+
215+ check_iex_result ()
216+ {
217+ result=$?
218+ if [ $result -eq 127 ] ; then
219+ echo " "
220+ echo " It seems there was some problem finding 'iex' binary from Elixir."
221+ echo " Probably ejabberd was compiled with Rebar3 and Elixir disabled, like:"
222+ echo " ./configure"
223+ echo " which is equivalent to:"
224+ echo " ./configure --with-rebar=rebar3 --disable-elixir"
225+ echo " To use 'iex', recompile ejabberd enabling Elixir or using Mix:"
226+ echo " ./configure --enable-elixir"
227+ echo " ./configure --with-rebar=mix"
228+ echo " "
229+ exit $result
201230 fi
202231}
203232
@@ -229,15 +258,34 @@ help()
229258}
230259
231260# dynamic node name helper
232- uid ()
233- {
234- uuid=$( uuidgen 2> /dev/null)
235- [ -z " $uuid " ] && [ -f /proc/sys/kernel/random/uuid ] && uuid=$( cat /proc/sys/kernel/random/uuid)
236- [ -z " $uuid " ] && uuid=$( printf " %X" " ${RANDOM:- $$ } $( date +%M%S) " )
237- uuid=$( printf ' %s' $uuid | sed ' s/^\(...\).*$/\1/' )
238- [ $# -eq 0 ] && echo " ${uuid} -${ERLANG_NODE} "
239- [ $# -eq 1 ] && echo " ${uuid} -${1} -${ERLANG_NODE} "
240- [ $# -eq 2 ] && echo " ${uuid} -${1} @${2} "
261+ uid () {
262+ ERTSVERSION=" $( " $ERL " -version 2>&1 | sed ' s|.*\([0-9][0-9]\).*|\1|g' ) "
263+ if [ $ERTSVERSION -lt 11 ] ; then # otp 23.0 includes erts 11.0
264+ # Erlang/OTP lower than 23, which doesn's support dynamic node code
265+ N=1
266+ PF=$(( $$ % 97 ))
267+ while
268+ case $# in
269+ 0) NN=" ${PF} -${N} -${ERLANG_NODE} "
270+ ;;
271+ 1) NN=" ${PF} -${N} -${1} -${ERLANG_NODE} "
272+ ;;
273+ 2) NN=" ${PF} -${N} -${1} @${2} "
274+ ;;
275+ esac
276+ N=$(( N + 1 + ( $$ % 5 ) ))
277+ " $EPMD " -names 2> /dev/null | grep -q " ${NN%@* } "
278+ do : ; done
279+ echo $NN
280+ else
281+ # Erlang/OTP 23 or higher: use native dynamic node code
282+ # https://www.erlang.org/patches/otp-23.0#OTP-13812
283+ if [ " $ERLANG_NODE " != " ${ERLANG_NODE% .* } " ]; then
284+ echo " undefined@${ERLANG_NODE#*@ } "
285+ else
286+ echo " undefined"
287+ fi
288+ fi
241289}
242290
243291# stop epmd if there is no other running node
0 commit comments