ejabberd - Comments for "Unable to run ejabberdctl connected-users command in nodes having long name" https://www.ejabberd.im/node/3563 en Badlop, I have made the https://www.ejabberd.im/node/3563#comment-54429 <p>Badlop,</p> <p>I have made the suggested changes and the output is little weird, on the first node ie <noindex><a href="mailto:ejabberd@first.abc.com" rel="nofollow" >ejabberd@first.abc.com</a></noindex> if I run</p> <p>/sbin/ejabberdctl --node <noindex><a href="mailto:ejabberd@first.abc.com" rel="nofollow" >ejabberd@first.abc.com</a></noindex> connected-users</p> <p>it throw an error </p> <p>RPC failed on the node 'ejabberd@first.abc.cocm': nodedown</p> <p>but same work if I run for <noindex><a href="mailto:ejabberd@second.abc.com" rel="nofollow" >ejabberd@second.abc.com</a></noindex> on the first node ie </p> <p>/sbin/ejabberdctl --node <noindex><a href="mailto:ejabberd@second.abc.com" rel="nofollow" >ejabberd@second.abc.com</a></noindex> connected-users</p> <p>works fine - list the online users</p> <p>and made same changes of ejabberdctl on second node and the found the same behavior that is in second node I'm able to list online users for first node <noindex><a href="mailto:ejabberd@first.abc.com" rel="nofollow" >ejabberd@first.abc.com</a></noindex> but throw an error 'RPC failed node down' for <noindex><a href="mailto:ejabberd@second.abc.com" rel="nofollow" >ejabberd@second.abc.com</a></noindex></p> <p>Also i tried to understand the changes... but given up since it's hard to start with out understanding the basic</p> <p>But the admin interface able to lists the online users on both the nodes correctly</p> <p>Here is how my /sbin/ejabberdctl looks like</p> <p>#!/bin/sh</p> <p># define default configuration<br /> POLL=true<br /> SMP=auto<br /> ERL_MAX_PORTS=32000<br /> ERL_PROCESSES=250000<br /> ERL_MAX_ETS_TABLES=1400</p> <p># define default environment variables<br /> NODE=ejabberd<br /> #HOST=localhost<br /> HOST=first.tutorvista.com<br /> ERLANG_NODE=$NODE@$HOST<br /> ROOTDIR=/<br /> EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg<br /> LOGS_DIR=$ROOTDIR/var/log/ejabberd/<br /> EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$ERLANG_NODE</p> <p># read custom configuration<br /> CONFIG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg<br /> [ -f "$CONFIG" ] &amp;&amp; . "$CONFIG"</p> <p># parse command line parameters<br /> ARGS=<br /> while [ $# -ne 0 ] ; do<br /> PARAM=$1<br /> shift<br /> case $PARAM in<br /> --) break ;;<br /> --node) ERLANG_NODE=$1; shift ;;<br /> --config) EJABBERD_CONFIG_PATH=$1 ; shift ;;<br /> --ctl-config) CONFIG=$1 ; shift ;;<br /> --logs) LOGS_DIR=$1 ; shift ;;<br /> --spool) EJABBERD_DB=$1 ; shift ;;<br /> *) ARGS="$ARGS $PARAM" ;;<br /> esac<br /> done</p> <p>NAME=-name<br /> [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] &amp;&amp; NAME=-sname</p> <p>ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES"</p> <p># define additional environment variables<br /> EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin<br /> EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs<br /> EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib<br /> EJABBERD_BIN_PATH=$ROOTDIR/var/lib/ejabberd/priv/bin<br /> EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log<br /> SASL_LOG_PATH=$LOGS_DIR/sasl.log<br /> DATETIME=`date "+%Y%m%d-%H%M%S"`<br /> ERL_CRASH_DUMP=$LOGS_DIR/erl_crash_$DATETIME.dump<br /> ERL_INETRC=$ROOTDIR/etc/ejabberd/inetrc<br /> HOME=$ROOTDIR/var/lib/ejabberd</p> <p># export global variables<br /> export EJABBERD_CONFIG_PATH<br /> export EJABBERD_MSGS_PATH<br /> export EJABBERD_LOG_PATH<br /> export EJABBERD_SO_PATH<br /> export EJABBERD_BIN_PATH<br /> export ERL_CRASH_DUMP<br /> export ERL_INETRC<br /> export ERL_MAX_PORTS<br /> export ERL_MAX_ETS_TABLES<br /> export HOME</p> <p>[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB<br /> [ -d $LOGS_DIR ] || mkdir -p $LOGS_DIR</p> <p># Compatibility in ZSH<br /> #setopt shwordsplit 2&gt;/dev/null</p> <p># start server<br /> start ()<br /> {<br /> erl \<br /> $NAME $ERLANG_NODE \<br /> -noinput -detached \<br /> -pa $EJABBERD_EBIN \<br /> -mnesia dir "\"$EJABBERD_DB\"" \<br /> -s ejabberd \<br /> -sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\} \<br /> $ERLANG_OPTS $ARGS "$@"<br /> }</p> <p># attach to server<br /> debug ()<br /> {<br /> echo "--------------------------------------------------------------------"<br /> echo ""<br /> echo "IMPORTANT: we will attempt to attach an INTERACTIVE shell"<br /> echo "to an already running ejabberd node."<br /> echo "If an ERROR is printed, it means the connection was not succesfull."<br /> echo "You can interact with the ejabberd node if you know how to use it."<br /> echo "Please be extremely cautious with your actions,"<br /> echo "and exit immediately if you are not completely sure."<br /> echo ""<br /> echo "To detach this shell from ejabberd, press:"<br /> echo " control+c, control+c"<br /> echo ""<br /> echo "--------------------------------------------------------------------"<br /> echo "Press any key to continue"<br /> read foo<br /> echo ""<br /> erl \<br /> $NAME debug-${ERLANG_NODE} \<br /> -remsh $ERLANG_NODE \<br /> $ERLANG_OPTS $ARGS "$@"<br /> }</p> <p># start interactive server<br /> live ()<br /> {<br /> echo "--------------------------------------------------------------------"<br /> echo ""<br /> echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."<br /> echo "All log messages will be shown in the command shell."<br /> echo "You can interact with the ejabberd node if you know how to use it."<br /> echo "Please be extremely cautious with your actions,"<br /> echo "and exit immediately if you are not completely sure."<br /> echo ""<br /> echo "To exit this LIVE mode and stop ejabberd, press:"<br /> echo " q(). and press the Enter key"<br /> echo ""<br /> echo "--------------------------------------------------------------------"<br /> echo "Press any key to continue"<br /> read foo<br /> echo ""<br /> erl \<br /> $NAME $ERLANG_NODE \<br /> $ERLANG_OPTS \<br /> -pa $EJABBERD_EBIN \<br /> -mnesia dir "\"$EJABBERD_DB\"" \<br /> -s ejabberd \<br /> $ERLANG_OPTS $ARGS "$@"<br /> }</p> <p># common control function<br /> ctl ()<br /> {<br /> erl \<br /> $NAME ctl-${ERLANG_NODE} \<br /> -noinput \<br /> -pa $EJABBERD_EBIN \<br /> -s ejabberd_ctl -extra $ERLANG_NODE $@<br /> result=$?<br /> case $result in<br /> 0) :;;<br /> *)<br /> echo ""<br /> echo "Commands to start an ejabberd node:"<br /> echo " start Start an ejabberd node in server mode"<br /> echo "Press any key to continue"<br /> read foo<br /> echo ""<br /> erl \<br /> $NAME debug-${ERLANG_NODE} \<br /> -remsh $ERLANG_NODE \<br /> $ERLANG_OPTS $ARGS "$@"<br /> }</p> <p># start interactive server<br /> live ()<br /> {<br /> echo "--------------------------------------------------------------------"<br /> echo ""<br /> echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."<br /> echo "All log messages will be shown in the command shell."<br /> echo "You can interact with the ejabberd node if you know how to use it."<br /> echo "Please be extremely cautious with your actions,"<br /> echo "and exit immediately if you are not completely sure."<br /> echo ""<br /> echo "To exit this LIVE mode and stop ejabberd, press:"<br /> echo " q(). and press the Enter key"<br /> echo ""<br /> echo "--------------------------------------------------------------------"<br /> echo "Press any key to continue"<br /> read foo<br /> echo ""<br /> erl \<br /> $NAME $ERLANG_NODE \<br /> $ERLANG_OPTS \<br /> -pa $EJABBERD_EBIN \<br /> -mnesia dir "\"$EJABBERD_DB\"" \<br /> -s ejabberd \<br /> $ERLANG_OPTS $ARGS "$@"<br /> }</p> <p># common control function<br /> ctl ()<br /> {<br /> erl \<br /> $NAME ctl-${ERLANG_NODE} \<br /> -noinput \<br /> -pa $EJABBERD_EBIN \<br /> -s ejabberd_ctl -extra $ERLANG_NODE $@<br /> result=$?<br /> case $result in<br /> 0) :;;<br /> *)<br /> echo ""<br /> echo "Commands to start an ejabberd node:"<br /> echo " start Start an ejabberd node in server mode"<br /> echo " debug Attach an interactive Erlang shell to a running ejabberd node"<br /> echo " live Start an ejabberd node in live (interactive) mode"<br /> echo ""<br /> echo "Optional parameters when starting an ejabberd node:"<br /> echo " --config file Config file of ejabberd: $EJABBERD_CONFIG_PATH"<br /> echo " --ctl-config file Config file of ejabberdctl: $CONFIG"<br /> echo " --logs dir Directory for logs: $LOGS_DIR"<br /> echo " --spool dir Database spool dir: $EJABBERD_DB"<br /> echo "";;<br /> esac<br /> return $result<br /> }</p> <p># display ctl usage<br /> usage ()<br /> {<br /> ctl<br /> exit<br /> }</p> <p>case $ARGS in<br /> ' start') start;;<br /> ' debug') debug;;<br /> ' live') live;;<br /> *) ctl $ARGS;;<br /> esac</p> Fri, 03 Jul 2009 05:28:24 +0000 GP comment 54429 at https://www.ejabberd.im Try this change https://www.ejabberd.im/node/3563#comment-54422 <p>I think I found the problem. Can you try a small change on your ejabberdctl script? You can see where that script is installed in your system with "which ejabberdctl".</p> <pre> --- ejabberdctl +++ ejabberdctl @@ -162,7 +162,7 @@ debug () read foo echo "" $EXEC_CMD "$ERL \ - $NAME ${NODE}debug \ + $NAME debug-${ERLANG_NODE} \ -remsh $ERLANG_NODE \ $ERLANG_OPTS $ARGS \"$@\"" } @@ -216,7 +216,7 @@ ctl () { COMMAND=$@ $EXEC_CMD "$ERL \ - $NAME ejabberdctl \ + $NAME ctl-${ERLANG_NODE} \ -noinput \ -pa $EJABBERD_EBIN_PATH \ -s ejabberd_ctl -extra $ERLANG_NODE $COMMAND" </pre> Wed, 01 Jul 2009 07:59:00 +0000 mfoss comment 54422 at https://www.ejabberd.im