24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-04 23:15:31 +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 if [ "$EJABBERDCTL_CONFIG_PATH" = "" ] ; then
EJABBERDCTL_CONFIG_PATH=$ETCDIR/ejabberdctl.cfg EJABBERDCTL_CONFIG_PATH=$ETCDIR/ejabberdctl.cfg
fi fi
[ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH" if [ -f "$EJABBERDCTL_CONFIG_PATH" ] ; then
. "$EJABBERDCTL_CONFIG_PATH"
fi
if [ "$LOGS_DIR" = "" ] ; then if [ "$LOGS_DIR" = "" ] ; then
LOGS_DIR=@LOCALSTATEDIR@/log/ejabberd LOGS_DIR=@LOCALSTATEDIR@/log/ejabberd
fi fi
@ -75,7 +77,9 @@ if [ "$EXEC_CMD" = "false" ] ; then
fi fi
NAME=-name NAME=-name
[ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && NAME=-sname if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
NAME=-sname
fi
KERNEL_OPTS="" KERNEL_OPTS=""
if [ "$FIREWALL_WINDOW" != "" ] ; then if [ "$FIREWALL_WINDOW" != "" ] ; then
@ -352,13 +356,13 @@ check_start()
{ {
epmd -names | grep -q $NODE && { epmd -names | grep -q $NODE && {
ps ux | grep -v grep | grep -q $ERLANG_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 exit 4
} || { } || {
ps ux | grep beam | grep -v "grep beam" && { ps ux | grep beam | grep -v "grep beam" && {
echo "ejabberd node is registered, but no ejabberd process has been found." echo "ERROR: The ejabberd node '$ERLANG_NODE' is registered,"
echo "can not kill epmd as other erlang nodes are running." echo " but no ejabberd process has been found."
echo "please stop all erlang nodes, and call 'epmd -kill'." echo "Shutdown other erlang nodes, and call 'epmd -kill'."
exit 5 exit 5
} || { } || {
epmd -kill epmd -kill