From a22c88a5c0cd058e0cbb471e04a1926f0c9c8a27 Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 4 Dec 2025 15:42:03 +0100 Subject: [PATCH] ejabberdctl.template: Show meaningful error when ERL_DIST_PORT is in use --- ejabberdctl.template | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ejabberdctl.template b/ejabberdctl.template index 972afe0bc..cec891a79 100755 --- a/ejabberdctl.template +++ b/ejabberdctl.template @@ -312,7 +312,17 @@ stop_epmd() # if all ok, ensure runtime directory exists and make it current directory check_start() { - [ -n "$ERL_DIST_PORT" ] && return + [ -n "$ERL_DIST_PORT" ] && { + netstat -nl | grep ":5210" >/dev/null && { + echo "Error: The file ejabberdctl.cfg has configured ERL_DIST_PORT=$ERL_DIST_PORT" + echo " but the port 5210 is already in use." + echo " Stop that program or configure a different ERL_DIST_PORT" + echo "" + netstat -nlp | grep ":5210" + echo "" + } + return + } "$EPMD" -names 2>/dev/null | grep -q " ${ERLANG_NODE%@*} " && { pgrep -f "$ERLANG_NODE" >/dev/null && { echo "ERROR: The ejabberd node '$ERLANG_NODE' is already running."