mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Minor fixes in the new ejabberdctl flock code
This commit is contained in:
parent
6557136426
commit
60ffcd78f1
@ -229,13 +229,12 @@ install: all
|
|||||||
install -d -m 750 $(O_USER) $(SPOOLDIR)
|
install -d -m 750 $(O_USER) $(SPOOLDIR)
|
||||||
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT)
|
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT)
|
||||||
chmod -R 750 $(SPOOLDIR)
|
chmod -R 750 $(SPOOLDIR)
|
||||||
|
[ ! -f $(COOKIEFILE) ] || { $(CHOWN_COMMAND) @INSTALLUSER@ $(COOKIEFILE) >$(CHOWN_OUTPUT) ; chmod 400 $(COOKIEFILE) ; }
|
||||||
|
#
|
||||||
# ejabberdctl lock directory
|
# ejabberdctl lock directory
|
||||||
install -d -m 750 $(O_USER) $(CTLLOCKDIR)
|
install -d -m 750 $(O_USER) $(CTLLOCKDIR)
|
||||||
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(CTLLOCKDIR) >$(CHOWN_OUTPUT)
|
$(CHOWN_COMMAND) -R @INSTALLUSER@ $(CTLLOCKDIR) >$(CHOWN_OUTPUT)
|
||||||
chmod -R 750 $(CTLLOCKDIR)
|
chmod -R 750 $(CTLLOCKDIR)
|
||||||
|
|
||||||
[ ! -f $(COOKIEFILE) ] || { $(CHOWN_COMMAND) @INSTALLUSER@ $(COOKIEFILE) >$(CHOWN_OUTPUT) ; chmod 400 $(COOKIEFILE) ; }
|
|
||||||
#
|
#
|
||||||
# Log directory
|
# Log directory
|
||||||
install -d -m 750 $(O_USER) $(LOGDIR)
|
install -d -m 750 $(O_USER) $(LOGDIR)
|
||||||
|
@ -14,17 +14,6 @@ ERLANG_NODE=$NODE@$HOST
|
|||||||
ERL=@erl@
|
ERL=@erl@
|
||||||
INSTALLUSER=@installuser@
|
INSTALLUSER=@installuser@
|
||||||
|
|
||||||
# Control number of connections identifiers
|
|
||||||
# using flock if available. Expects a linux-style
|
|
||||||
# flock that can lock a file descriptor.
|
|
||||||
MAXCONNID=100
|
|
||||||
CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl
|
|
||||||
FLOCK='/usr/bin/flock'
|
|
||||||
if [ ! -x "$FLOCK" ];then
|
|
||||||
FLOCK=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# parse command line parameters
|
# parse command line parameters
|
||||||
ARGS=
|
ARGS=
|
||||||
while [ $# -ne 0 ] ; do
|
while [ $# -ne 0 ] ; do
|
||||||
@ -164,7 +153,7 @@ debug ()
|
|||||||
echo ""
|
echo ""
|
||||||
echo "IMPORTANT: we will attempt to attach an INTERACTIVE shell"
|
echo "IMPORTANT: we will attempt to attach an INTERACTIVE shell"
|
||||||
echo "to an already running ejabberd node."
|
echo "to an already running ejabberd node."
|
||||||
echo "If an ERROR is printed, it means the connection was not succesfull."
|
echo "If an ERROR is printed, it means the connection was not successful."
|
||||||
echo "You can interact with the ejabberd node if you know how to use it."
|
echo "You can interact with the ejabberd node if you know how to use it."
|
||||||
echo "Please be extremely cautious with your actions,"
|
echo "Please be extremely cautious with your actions,"
|
||||||
echo "and exit immediately if you are not completely sure."
|
echo "and exit immediately if you are not completely sure."
|
||||||
@ -240,16 +229,26 @@ ctl ()
|
|||||||
{
|
{
|
||||||
COMMAND=$@
|
COMMAND=$@
|
||||||
|
|
||||||
|
# Control number of connections identifiers
|
||||||
|
# using flock if available. Expects a linux-style
|
||||||
|
# flock that can lock a file descriptor.
|
||||||
|
MAXCONNID=100
|
||||||
|
CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl
|
||||||
|
FLOCK='/usr/bin/flock'
|
||||||
|
if [ ! -x "$FLOCK" ] ; then
|
||||||
|
FLOCK=""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! "$FLOCK" ] ; then
|
if [ ! "$FLOCK" ] ; then
|
||||||
# no flock, simply invoke ctlexec()
|
# no flock, simply invoke ctlexec()
|
||||||
CTL_CONN="ctl-${EJABBERD_NODE}"
|
CTL_CONN="ctl-${ERLANG_NODE}"
|
||||||
ctlexec $CTL_CONN $COMMAND
|
ctlexec $CTL_CONN $COMMAND
|
||||||
result=$?
|
result=$?
|
||||||
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
|
||||||
# conn names -- this allows
|
# conn names -- this allows
|
||||||
# concurrent invokations using a bound
|
# concurrent invocations using a bound
|
||||||
# number of atoms
|
# number of atoms
|
||||||
for N in $(seq 1 $MAXCONNID); do
|
for N in $(seq 1 $MAXCONNID); do
|
||||||
CTL_CONN="ejabberdctl-$N"
|
CTL_CONN="ejabberdctl-$N"
|
||||||
@ -283,7 +282,7 @@ ctl ()
|
|||||||
if [ "$badlock" ];then
|
if [ "$badlock" ];then
|
||||||
echo "Ran out of connections to try. Your ejabberd processes" >&2
|
echo "Ran out of connections to try. Your ejabberd processes" >&2
|
||||||
echo "may be stuck or this is a very busy server. For very" >&2
|
echo "may be stuck or this is a very busy server. For very" >&2
|
||||||
echo "busy servers, consider raising MAXCONNIDS" >&2
|
echo "busy servers, consider raising MAXCONNID in ejabberdctl">&2
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user