24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-02 23:06:21 +02:00

Check node name is available before starting ejabberd (EJAB-1572)

This commit is contained in:
Badlop 2012-06-08 17:33:21 +02:00 committed by Christophe Romain
parent 9787416e88
commit 9442a583bc

View File

@ -41,7 +41,9 @@ fi
if [ "$EJABBERDCTL_CONFIG_PATH" = "" ] ; then
EJABBERDCTL_CONFIG_PATH=$ETCDIR/ejabberdctl.cfg
fi
[ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH"
if [ -f "$EJABBERDCTL_CONFIG_PATH" ] ; then
. "$EJABBERDCTL_CONFIG_PATH"
fi
if [ "$LOGS_DIR" = "" ] ; then
LOGS_DIR=@LOCALSTATEDIR@/log/ejabberd
fi
@ -75,7 +77,9 @@ if [ "$EXEC_CMD" = "false" ] ; then
fi
NAME=-name
[ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && NAME=-sname
if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
NAME=-sname
fi
KERNEL_OPTS=""
if [ "$FIREWALL_WINDOW" != "" ] ; then
@ -352,13 +356,13 @@ check_start()
{
epmd -names | grep -q $NODE && {
ps ux | grep -v grep | grep -q $ERLANG_NODE && {
echo "ejabberd is already running."
echo "ERROR: The ejabberd node '$ERLANG_NODE' is already running."
exit 4
} || {
ps ux | grep beam | grep -v "grep beam" && {
echo "ejabberd node is registered, but no ejabberd process has been found."
echo "can not kill epmd as other erlang nodes are running."
echo "please stop all erlang nodes, and call 'epmd -kill'."
echo "ERROR: The ejabberd node '$ERLANG_NODE' is registered,"
echo " but no ejabberd process has been found."
echo "Shutdown other erlang nodes, and call 'epmd -kill'."
exit 5
} || {
epmd -kill