diff options
author | Badlop <badlop@process-one.net> | 2010-02-12 20:50:56 +0100 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2010-02-12 20:50:56 +0100 |
commit | 2cca00acc0a95784e1bea65c6004ff4125930824 (patch) | |
tree | 50d88f5ead1c3b944b58e02446e08d2886240546 /src/ejabberdctl.template | |
parent | Minor fixes in the new ejabberdctl flock code (diff) |
Added support for Jot in ctl and TTY in debug (thanks to Jan Koum)
Diffstat (limited to 'src/ejabberdctl.template')
-rw-r--r-- | src/ejabberdctl.template | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/ejabberdctl.template b/src/ejabberdctl.template index b2692289..d425a18c 100644 --- a/src/ejabberdctl.template +++ b/src/ejabberdctl.template @@ -169,8 +169,9 @@ debug () read foo fi echo "" + TTY=`tty | cut -f4 -d'/'` $EXEC_CMD "$ERL \ - $NAME debug-${ERLANG_NODE} \ + $NAME debug-${TTY}-${ERLANG_NODE} \ -remsh $ERLANG_NODE \ -hidden \ $ERLANG_OPTS $ARGS \"$@\"" @@ -236,14 +237,19 @@ ctl () CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl FLOCK='/usr/bin/flock' if [ ! -x "$FLOCK" ] ; then - FLOCK="" - fi - - if [ ! "$FLOCK" ] ; then - # no flock, simply invoke ctlexec() - CTL_CONN="ctl-${ERLANG_NODE}" - ctlexec $CTL_CONN $COMMAND - result=$? + JOT='/usr/bin/jot' + if [ ! -x "$JOT" ] ; then + # no flock or jot, simply invoke ctlexec() + CTL_CONN="ctl-${ERLANG_NODE}" + ctlexec $CTL_CONN $COMMAND + 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 # we have flock so we get a lock # on one of a limited number of |