Minor cosmetic changes and add ping command

This commit is contained in:
Christophe Romain 2015-05-22 17:28:40 +02:00
parent 0d322d8dab
commit 90225a4744
1 changed files with 24 additions and 15 deletions

View File

@ -16,9 +16,6 @@ IEX={{bindir}}/iex
EPMD={{bindir}}/epmd EPMD={{bindir}}/epmd
INSTALLUSER={{installuser}} INSTALLUSER={{installuser}}
# Compatibility in ZSH
#setopt shwordsplit 2>/dev/null
# check the proper system user is used if defined # check the proper system user is used if defined
if [ "$INSTALLUSER" != "" ] ; then if [ "$INSTALLUSER" != "" ] ; then
EXEC_CMD="false" EXEC_CMD="false"
@ -241,14 +238,6 @@ iexlive()
--erl \"$ERLANG_OPTS\" --erl $ARGS --erl \"$@\"" --erl \"$ERLANG_OPTS\" --erl $ARGS --erl \"$@\""
} }
etop()
{
$EXEC_CMD "$ERL \
$NAME debug-${TTY}-${ERLANG_NODE} \
-hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
}
# TODO: refactor debug warning and livewarning
debugwarning() debugwarning()
{ {
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
@ -270,7 +259,7 @@ debugwarning()
echo "Press return to continue" echo "Press return to continue"
read foo read foo
echo "" echo ""
fi fi
} }
livewarning() livewarning()
@ -297,7 +286,26 @@ livewarning()
fi fi
} }
# TODO: Make iex command display only if ejabberd Elixir support has been enabled etop()
{
TTY=`tty | sed -e 's/.*\///g'`
$EXEC_CMD "$ERL \
$NAME debug-${TTY}-${ERLANG_NODE} \
-hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
}
ping()
{
TTY=`tty | sed -e 's/.*\///g'`
$EXEC_CMD "$ERL \
$NAME ping-${TTY}-${ERLANG_NODE} \
-hidden \
-pa $EJABBERD_EBIN_PATH \
$KERNEL_OPTS $ERLANG_OPTS \
-eval 'io:format(\"~p~n\",[net_adm:ping($1)])' \
-s erlang halt -output text -noinput"
}
help() help()
{ {
echo "" echo ""
@ -328,9 +336,9 @@ ctl()
# flock that can lock a file descriptor. # flock that can lock a file descriptor.
MAXCONNID=100 MAXCONNID=100
CONNLOCKDIR={{localstatedir}}/lock/ejabberdctl CONNLOCKDIR={{localstatedir}}/lock/ejabberdctl
FLOCK='/usr/bin/flock' FLOCK=/usr/bin/flock
if [ ! -x "$FLOCK" ] || [ ! -d "$CONNLOCKDIR" ] ; then if [ ! -x "$FLOCK" ] || [ ! -d "$CONNLOCKDIR" ] ; then
JOT='/usr/bin/jot' JOT=/usr/bin/jot
if [ ! -x "$JOT" ] ; then if [ ! -x "$JOT" ] ; then
# no flock or jot, simply invoke ctlexec() # no flock or jot, simply invoke ctlexec()
CTL_CONN="ctl-${ERLANG_NODE}" CTL_CONN="ctl-${ERLANG_NODE}"
@ -470,6 +478,7 @@ case $ARGS in
' iexdebug') iexdebug;; ' iexdebug') iexdebug;;
' live') live;; ' live') live;;
' iexlive') iexlive;; ' iexlive') iexlive;;
' ping'*) ping ${ARGS# ping};;
' etop') etop;; ' etop') etop;;
' started') wait_for_status 0 30 2;; # wait 30x2s before timeout ' started') wait_for_status 0 30 2;; # wait 30x2s before timeout
' stopped') wait_for_status 3 15 2 && stop_epmd;; # wait 15x2s before timeout ' stopped') wait_for_status 3 15 2 && stop_epmd;; # wait 15x2s before timeout