25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01: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
parent bc077266d9
commit 75756f0fc9

View File

@ -143,6 +143,9 @@ export EXEC_CMD
# start server # start server
start () start ()
{ {
checknodenameusage
[ "$?" -eq 0 ] && echo "\nERROR: The node '$ERLANG_NODE' is already running." && return 1
$EXEC_CMD "$ERL \ $EXEC_CMD "$ERL \
$NAME $ERLANG_NODE \ $NAME $ERLANG_NODE \
-noinput -detached \ -noinput -detached \
@ -189,6 +192,9 @@ debug ()
# start interactive server # start interactive server
live () live ()
{ {
checknodenameusage
[ "$?" -eq 0 ] && echo "\nERROR: The node '$ERLANG_NODE' is already running." && return 1
echo "--------------------------------------------------------------------" echo "--------------------------------------------------------------------"
echo "" echo ""
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode." echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
@ -362,6 +368,15 @@ wait_for_status()
return $status return $status
} }
# check node name is used or not
# $? --> 0=alreadyused 1=available
checknodenameusage ()
{
$EXEC_CMD "$ERL \
$NAME $ERLANG_NODE \
-s erlang halt | grep -c duplicate_name > /dev/null "
}
case $ARGS in case $ARGS in
' start') start;; ' start') start;;
' debug') debug;; ' debug') debug;;