25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Added support for Jot in ctl and TTY in debug (thanks to Jan Koum)

This commit is contained in:
Badlop 2010-02-12 20:50:56 +01:00
parent 7c36e304f0
commit 2cca00acc0

View File

@ -169,8 +169,9 @@ debug ()
read foo read foo
fi fi
echo "" echo ""
TTY=`tty | cut -f4 -d'/'`
$EXEC_CMD "$ERL \ $EXEC_CMD "$ERL \
$NAME debug-${ERLANG_NODE} \ $NAME debug-${TTY}-${ERLANG_NODE} \
-remsh $ERLANG_NODE \ -remsh $ERLANG_NODE \
-hidden \ -hidden \
$ERLANG_OPTS $ARGS \"$@\"" $ERLANG_OPTS $ARGS \"$@\""
@ -236,14 +237,19 @@ ctl ()
CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl
FLOCK='/usr/bin/flock' FLOCK='/usr/bin/flock'
if [ ! -x "$FLOCK" ] ; then if [ ! -x "$FLOCK" ] ; then
FLOCK="" JOT='/usr/bin/jot'
fi if [ ! -x "$JOT" ] ; then
# no flock or jot, simply invoke ctlexec()
if [ ! "$FLOCK" ] ; then
# no flock, simply invoke ctlexec()
CTL_CONN="ctl-${ERLANG_NODE}" CTL_CONN="ctl-${ERLANG_NODE}"
ctlexec $CTL_CONN $COMMAND ctlexec $CTL_CONN $COMMAND
result=$? result=$?
else
# no flock, but at least there is jot
RAND=`jot -r 1 0 $MAXCONNID`
CTL_CONN="ctl-${RAND}-${ERLANG_NODE}"
ctlexec $CTL_CONN $COMMAND
result=$?
fi
else else
# we have flock so we get a lock # we have flock so we get a lock
# on one of a limited number of # on one of a limited number of