25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +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> 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 * src/mod_privacy.erl: Bugfix
2007-10-07 Alexey Shchepin <alexey@process-one.net> 2007-10-07 Alexey Shchepin <alexey@process-one.net>

View File

@ -95,12 +95,14 @@ install: all
install -m 644 *.app $(BEAMDIR) install -m 644 *.app $(BEAMDIR)
install -d $(SODIR) install -d $(SODIR)
install -m 644 *.so $(SODIR) install -m 644 *.so $(SODIR)
install -m 750 epam $(SODIR) -install -m 750 epam $(SODIR)
install -d $(MSGSDIR) install -d $(MSGSDIR)
install -m 644 msgs/*.msg $(MSGSDIR) install -m 644 msgs/*.msg $(MSGSDIR)
install -d $(ETCDIR) 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 [ -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 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 -d $(SBINDIR)
install -m 755 ejabberdctl.example $(SBINDIR)/ejabberdctl install -m 755 ejabberdctl.example $(SBINDIR)/ejabberdctl
install -d $(LOGDIR) 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 NODE=ejabberd
HOST=localhost HOST=localhost
ERLANG_NODE=$NODE@$HOST
# Define ejabberd environment # Define ejabberd environment
ROOTDIR=@rootdir@ ROOTDIR=@rootdir@
SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log EJABBERD_CFG=$ROOTDIR/etc/ejabberd/ejabberd.cfg
EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE EJABBERDCTL_CFG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg
EJABBERD_INETRC=$ROOTDIR/etc/ejabberd/ejabberd.inetrc
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
export EJABBERD_LOG_PATH=$ROOTDIR/var/log/ejabberd/ejabberd.log EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
export EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs
export EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib
export EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib EJABBERD_LOG_PATH=$ROOTDIR/var/log/ejabberd/ejabberd.log
export ERL_MAX_PORTS=32000 SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log
[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB [ -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 function start
{ {
erl \ erl \
$SNAME $ERLANG_NODE \
$ERLANG_OPTS \
-noinput -detached \ -noinput -detached \
-sname $NODE@$HOST \ -sname $NODE@$HOST \
-pa $EJABBERD_EBIN \ -pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \ -mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd \ -s ejabberd \
-ejabberd config \"$EJABBERD_CONFIG_PATH\" \ -ejabberd config \"$EJABBERD_CFG\" \
log_path \"$EJABBERD_LOG_PATH\" \ log_path \"$EJABBERD_LOG_PATH\" \
-sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\} -sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\}
} }
function debug 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 \ 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 \ -pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \ -mnesia dir "\"$EJABBERD_DB\"" \
-remsh $NODE@$HOST -ejabberd config \"$EJABBERD_CFG\" \
-s ejabberd
} }
function ctl function ctl
@ -44,7 +105,11 @@ function ctl
-noinput \ -noinput \
-sname ejabberdctl@$HOST \ -sname ejabberdctl@$HOST \
-pa $EJABBERD_EBIN \ -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 function usage
@ -53,11 +118,19 @@ function usage
exit 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 case $1 in
start) start;; start) start;;
debug) debug;; debug) debug;;
live) live;;
*) ctl $@;; *) ctl $@;;
esac esac