25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/ejabberdctl.template: Several improvements (EJAB-380)

(thanks to Sander Devrieze, Sergei Golovan, Torsten Werner and
Badlop)
* src/ejabberdctl.cfg.example: Likewise
* src/ejabberd.inetrc: Likewise
* src/Makefile.in: Likewise

SVN Revision: 959
This commit is contained in:
Alexey Shchepin 2007-10-17 02:33:19 +00:00
parent 7583eef401
commit 0d557566fb
5 changed files with 170 additions and 14 deletions

View File

@ -1,5 +1,12 @@
2007-10-17 Alexey Shchepin <alexey@process-one.net>
* src/ejabberdctl.template: Several improvements (EJAB-380)
(thanks to Sander Devrieze, Sergei Golovan, Torsten Werner and
Badlop)
* src/ejabberdctl.cfg.example: Likewise
* src/ejabberd.inetrc: Likewise
* src/Makefile.in: Likewise
* src/mod_privacy.erl: Bugfix
2007-10-07 Alexey Shchepin <alexey@process-one.net>

View File

@ -95,12 +95,14 @@ install: all
install -m 644 *.app $(BEAMDIR)
install -d $(SODIR)
install -m 644 *.so $(SODIR)
install -m 750 epam $(SODIR)
-install -m 750 epam $(SODIR)
install -d $(MSGSDIR)
install -m 644 msgs/*.msg $(MSGSDIR)
install -d $(ETCDIR)
[ -f $(ETCDIR)/ejabberd.cfg ] && install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new || install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg
sed -e "s*@rootdir@*@prefix@*" ejabberdctl.template > ejabberdctl.example
[ -f $(ETCDIR)/ejabberdctl.cfg ] && install -b -m 644 ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new || install -b -m 644 ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg
install -b -m 644 ejabberd.inetrc $(ETCDIR)/ejabberd.inetrc
install -d $(SBINDIR)
install -m 755 ejabberdctl.example $(SBINDIR)/ejabberdctl
install -d $(LOGDIR)

3
src/ejabberd.inetrc Normal file
View File

@ -0,0 +1,3 @@
{lookup,["file","native"]}.
{host,{127,0,0,1}, ["localhost","hostalias"]}.
{file, resolv, "/etc/resolv.conf"}.

View File

@ -0,0 +1,71 @@
# Additional options passed to erlang while starting ejabberd.
#
#export ERL_OPTIONS="-heart"
# ERL_MAX_PORTS: Maximum number of simultaneously open Erlang ports
#
# Erlang consumes one port for every connection, either from a client or from
# another Jabber server. The option ERL_MAX_PORTS limits the number of
# concurrent connections and can be specified when starting ejabberd.
#
# Default value: 1024
# Maximum value: 268435456
export ERL_MAX_PORTS=32000
# ERL_FULLSWEEP_AFTER: Maximum number of collections before a forced fullsweep
#
# To reduce memory usage, you can set environment variable ERL_FULLSWEEP_AFTER.
# But in this case ejabberd may work slower.
#
# The ERL_FULLSWEEP_AFTER option shrinks the size of the Erlang process after
# RAM intensive events. Note that this option may downgrade performance. Hence
# this option is only interesting on machines that also host other services
# (webserver, mail) on which ejabberd does not receive constant load.
#
# Default: 65535
#export ERL_FULLSWEEP_AFTER=0
# PROCESSES: Maximum number of Erlang processes (default=32768, max=268435456)
#
# Erlang consumes a lot of lightweight processes. If there is a lot of activity
# on ejabberd so that the maximum number of proccesses is reached, people will
# experiment greater latency times. As these processes are implemented in
# Erlang, and therefore not related to the operating system processes, you do
# not have to worry about allowing a huge number of them.
#PROCESSES="+P 32768"
# POLL: Kernel polling (-K true)
#
# The kernel polling option requires that you have support for it in your
# kernel. By default, Erlang currently supports kernel polling under FreeBSD,
# Mac OS X, and Solaris. If you use Linux, you need to apply a patch.
# Additionaly, you need to enable this feature while compiling Erlang.
#POLL="-K true"
# ERL_MAX_ETS_TABLES: Maximum number of ETS and Mnesia tables (default=1400)
#
# The number of concurrent ETS and Mnesia tables is limited. When the limit is
# reached, errors will appear in the logs:
#
# ** Too many db tables **
#
# You can safely increase this limit when starting ejabberd. It impacts memory
# consumption but the difference will be quite small.
ERL_MAX_ETS_TABLES="-env ERL_MAX_ETS_TABLES 1400"
# The next variable allows to explicitly specify erlang node for ejabberd
# It can be given in different formats:
# ERLANG_NODE=ejabberd
# Lets erlang add hostname to the node (ejabberd uses short name in this case)
# ERLANG_NODE=ejabberd@hostname
# Erlang uses node name as is (so make sure that hostname is a real machine
# hostname or you'll not be able to control ejabberd)
# ERLANG_NODE=ejabberd@hostname.domainname
# The same as previous, but erlang will use long hostname (see erl (1) manual for details)
#
#export ERLANG_NODE=ejabberd

View File

@ -2,40 +2,101 @@
NODE=ejabberd
HOST=localhost
ERLANG_NODE=$NODE@$HOST
# Define ejabberd environment
ROOTDIR=@rootdir@
SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log
EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
EJABBERD_CFG=$ROOTDIR/etc/ejabberd/ejabberd.cfg
EJABBERDCTL_CFG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg
EJABBERD_INETRC=$ROOTDIR/etc/ejabberd/ejabberd.inetrc
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
export EJABBERD_LOG_PATH=$ROOTDIR/var/log/ejabberd/ejabberd.log
export EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg
export EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs
export EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib
export ERL_MAX_PORTS=32000
EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs
EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib
EJABBERD_LOG_PATH=$ROOTDIR/var/log/ejabberd/ejabberd.log
SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log
[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB
[ -f $EJABBERDCTL_CFG ] && . $EJABBERDCTL_CFG
HOME=$ROOTDIR/var/lib/ejabberd
export HOME
if [ $# -ne 0 ] ; then
case $1 in
--node) shift ; ERLANG_NODE=$1 ; shift ;;
esac
fi
if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
SNAME="-kernel inetrc \""$EJABBERD_INETRC"\" -sname"
else
SNAME=-name
fi
ERLANG_OPTS="$POLL $PROCESSES $ERL_MAX_ETS_TABLES"
function start
{
erl \
$SNAME $ERLANG_NODE \
$ERLANG_OPTS \
-noinput -detached \
-sname $NODE@$HOST \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd \
-ejabberd config \"$EJABBERD_CONFIG_PATH\" \
-ejabberd config \"$EJABBERD_CFG\" \
log_path \"$EJABBERD_LOG_PATH\" \
-sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\}
}
function debug
{
echo "--------------------------------------------------------------------"
echo ""
echo "IMPORTANT: we will attempt to attach an INTERACTIVE shell"
echo "to an already running ejabberd node."
echo "If an ERROR is printed, it means the connection was not succesfull."
echo "You can interact with the ejabberd node if you know how to use it."
echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure."
echo ""
echo "To detach this shell from ejabberd, press:"
echo " control+c, control+c"
echo ""
echo "--------------------------------------------------------------------"
read -p "Press any key to continue"
echo ""
erl \
-sname debug$NODE@$HOST \
$SNAME debug \
-remsh $ERLANG_NODE
}
function live
{
echo "--------------------------------------------------------------------"
echo ""
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
echo "All log messages will be shown in the command shell."
echo "You can interact with the ejabberd node if you know how to use it."
echo "Please be extremely cautious with your actions,"
echo "and exit immediately if you are not completely sure."
echo ""
echo "To exit this LIVE mode and stop ejabberd, press:"
echo " q(). and press the Enter key"
echo ""
echo "--------------------------------------------------------------------"
read -p "Press any key to continue"
echo ""
erl \
$SNAME $ERLANG_NODE \
$ERLANG_OPTS \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-remsh $NODE@$HOST
-ejabberd config \"$EJABBERD_CFG\" \
-s ejabberd
}
function ctl
@ -44,7 +105,11 @@ function ctl
-noinput \
-sname ejabberdctl@$HOST \
-pa $EJABBERD_EBIN \
-s ejabberd_ctl -extra $NODE@$HOST $@
-s ejabberd_ctl -extra $ERLANG_NODE $@
case $? in
2) help_start;;
3) help_start;;
esac
}
function usage
@ -53,11 +118,19 @@ function usage
exit
}
[ $# -lt 1 ] && usage
function help_start
{
echo ""
echo "Commands to start an ejabberd node:"
echo " start Start an ejabberd node in server mode"
echo " debug Attach an interactive Erlang shell to a running ejabberd node"
echo " live Start an ejabberd node in live (interactive) mode"
echo ""
}
case $1 in
start) start;;
debug) debug;;
live) live;;
*) ctl $@;;
esac