25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +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 ()
{
checknodenameusage
[ "$?" -eq 0 ] && echo "\nERROR: The node '$ERLANG_NODE' is already running." && return 1
$EXEC_CMD "$ERL \
$NAME $ERLANG_NODE \
-noinput -detached \
@ -189,6 +192,9 @@ debug ()
# start interactive server
live ()
{
checknodenameusage
[ "$?" -eq 0 ] && echo "\nERROR: The node '$ERLANG_NODE' is already running." && return 1
echo "--------------------------------------------------------------------"
echo ""
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
@ -362,6 +368,15 @@ wait_for_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
' start') start;;
' debug') debug;;