From 5bc9860f5db8403660e0a734508b144ba3ae0652 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 20 Jul 2010 14:05:18 +0200 Subject: [PATCH] add ejabberdctl ability to check epmd names (TECH-1121) --- src/ejabberdctl.template | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ejabberdctl.template b/src/ejabberdctl.template index 086955b43..06681f16a 100644 --- a/src/ejabberdctl.template +++ b/src/ejabberdctl.template @@ -137,6 +137,7 @@ export EXEC_CMD # start server start () { + check_start $EXEC_CMD "$ERL \ $NAME $ERLANG_NODE \ -noinput -detached \ @@ -182,6 +183,7 @@ debug () # start interactive server live () { + check_start echo "--------------------------------------------------------------------" echo "" echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode." @@ -338,6 +340,26 @@ stop_epmd() epmd -names | grep -q name || epmd -kill } +# make sure node not already running and node name unregistered +check_start() +{ + epmd -names | grep -q $NODE && { + ps ux | grep -q $ERLANG_NODE && { + echo "ejabberd 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'." + exit 5 + } || { + epmd -kill + } + } + } +} + # allow sync calls wait_for_status() {