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:
parent
bc077266d9
commit
75756f0fc9
@ -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;;
|
||||||
|
Loading…
Reference in New Issue
Block a user