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

* src/ejabberdctl.template: Create logs_dir if doesn't exist. New

parameters --config, --ctl-config, --logs, --spool. Crash dump
renamed to erl_crash_DATETIME.dump.

* src/ejabberdctl.template: Backport improvements from binary
installer (EJAB-488): options are simple values; enable Kernel
Poll by default, set SMP to auto, set max ports to 32000, max
processes to 250000.
* src/ejabberdctl.cfg.example: Likewise

* src/ejabberd.inetrc: Renamed ejabberd.inetrc to inetrc
* src/inetrc: Likewise
* src/Makefile.in: Likewise
* doc/guide.tex: Likewise

SVN Revision: 1133
This commit is contained in:
Badlop 2008-01-01 10:53:05 +00:00
parent c7e9fe1059
commit b23d82bc1e
6 changed files with 132 additions and 73 deletions

View File

@ -1,5 +1,22 @@
2007-12-31 Badlop <badlop@process-one.net>
2008-01-01 Badlop <badlop@process-one.net>
* src/ejabberdctl.template: Create logs_dir if doesn't exist. New
parameters --config, --ctl-config, --logs, --spool. Crash dump
renamed to erl_crash_DATETIME.dump.
* src/ejabberdctl.template: Backport improvements from binary
installer (EJAB-488): options are simple values; enable Kernel
Poll by default, set SMP to auto, set max ports to 32000, max
processes to 250000.
* src/ejabberdctl.cfg.example: Likewise
* src/ejabberd.inetrc: Renamed ejabberd.inetrc to inetrc
* src/inetrc: Likewise
* src/Makefile.in: Likewise
* doc/guide.tex: Likewise
2007-12-31 Badlop <badlop@process-one.net>
* src/msgs/ca.msg: Updated (thanks to Vicent Alberola Canet)
2007-12-29 Alexey Shchepin <alexey@process-one.net>

View File

@ -307,8 +307,8 @@ The files and directories created are, by default:
\titem{/etc/ejabberd/} Configuration files:
\begin{description}
\titem{ejabberd.cfg} ejabberd configuration file
\titem{ejabberd.inetrc} Network DNS configuration
\titem{ejabberdctl.cfg} Configuration file of the administration script
\titem{inetrc} Network DNS configuration
\end{description}
\titem{/sbin/ejabberdctl} Administration script
\titem{/var/lib/ejabberd/}
@ -322,7 +322,7 @@ The files and directories created are, by default:
\titem{msgs} Translated strings (*.msgs)
\end{description}
\end{description}
\titem{/var/log/ejabberd/} Log files (see section~\ref{logfiles}:
\titem{/var/log/ejabberd/} Log files (see section~\ref{logfiles}):
\begin{description}
\titem{ejabberd.log} Messages reported by ejabberd code
\titem{sasl.log} Messages reported by Erlang/OTP
@ -3329,7 +3329,7 @@ The basic parameters used by \term{ejabberdctl} when starting the Erlang node:
\titem{-name ejabberd}
The Erlang node will be fully identified.
This is only useful if you plan to setup an ejabberd cluster with nodes in different networks.
\titem{-kernel inetrc "/etc/ejabberd/ejabberd.inetrc"}
\titem{-kernel inetrc "/etc/ejabberd/inetrc"}
Indicates which IP name resolution to use. It is required if using \term{-sname}.
\titem{-detached}
Starts the Erlang system detached from the system console.

View File

@ -107,7 +107,7 @@ install: all
[ -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 -b -m 644 inetrc $(ETCDIR)/inetrc
install -d $(SBINDIR)
install -m 755 ejabberdctl.example $(SBINDIR)/ejabberdctl
install -d $(LOGDIR)

View File

@ -3,16 +3,16 @@
# to the erlang runtime system when starting ejabberd
#
# POLL: Kernel polling (+K [true|false])
# POLL: Kernel polling ([true|false])
#
# The kernel polling option requires support in the kernel.
# Additionaly, you need to enable this feature while compiling Erlang.
#
# Default: +K false
# Default: true
#
#POLL="+K true"
#POLL=true
# SMP: SMP support (-smp [enable|auto|disable])
# SMP: SMP support ([enable|auto|disable])
#
# Explanation in Erlang/OTP documentation:
# enable: starts the Erlang runtime system with SMP support enabled.
@ -21,9 +21,9 @@
# is available and more than one logical processor are detected.
# disable: starts a runtime system without SMP support.
#
# Default: -smp disable
# Default: auto
#
#SMP="-smp auto"
#SMP=auto
# ERL_MAX_PORTS: Maximum number of simultaneously open Erlang ports
#
@ -31,10 +31,10 @@
# from a client or from another Jabber server. So take this into
# account when setting this limit.
#
# Default: 1024
# Default: 32000
# Maximum: 268435456
#
export ERL_MAX_PORTS=32000
#ERL_MAX_PORTS=32000
# PROCESSES: Maximum number of Erlang processes
#
@ -44,10 +44,10 @@ export ERL_MAX_PORTS=32000
# Erlang, and therefore not related to the operating system processes, you do
# not have to worry about allowing a huge number of them.
#
# Default: 32768
# Default: 250000
# Maximum: 268435456
#
#PROCESSES="+P 32768"
#PROCESSES=250000
# ERL_MAX_ETS_TABLES: Maximum number of ETS and Mnesia tables
#
@ -59,7 +59,7 @@ export ERL_MAX_PORTS=32000
#
# Default: 1400
#
#ERL_MAX_ETS_TABLES="-env ERL_MAX_ETS_TABLES 1400"
#ERL_MAX_ETS_TABLES=1400
# ERL_FULLSWEEP_AFTER: Maximum number of collections before a forced fullsweep
#
@ -73,7 +73,7 @@ export ERL_MAX_PORTS=32000
#
# Default: 65535
#
#export ERL_FULLSWEEP_AFTER=0
#ERL_FULLSWEEP_AFTER=65536
# The next variable allows to explicitly specify erlang node for ejabberd
# It can be given in different formats:
@ -86,4 +86,6 @@ export ERL_MAX_PORTS=32000
# The same as previous, but erlang will use long hostname
# (see erl (1) manual for details)
#
#export ERLANG_NODE=ejabberd
# Default: ejabberd
#
#ERLANG_NODE=ejabberd

View File

@ -1,62 +1,90 @@
#!/bin/sh
# define default configuration
POLL=true
SMP=auto
ERL_MAX_PORTS=32000
ERL_PROCESSES=250000
ERL_MAX_ETS_TABLES=1400
ERL_FULLSWEEP_AFTER=65536
# define default environment variables
NODE=ejabberd
HOST=localhost
ERLANG_NODE=$NODE@$HOST
# Define ejabberd environment
ROOTDIR=@rootdir@
EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg
export EJABBERD_CONFIG_PATH
EJABBERDCTL_CFG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg
EJABBERD_INETRC=$ROOTDIR/etc/ejabberd/ejabberd.inetrc
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
LOGS_DIR=$ROOTDIR/var/log/ejabberd/
EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
# read custom configuration
CONFIG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg
[ -f "$CONFIG" ] && . "$CONFIG"
# parse command line parameters
ARGS=
while [ $# -ne 0 ] ; do
PARAM=$1
shift
case $PARAM in
--) break ;;
--node) ERLANG_NODE=$1; shift ;;
--config) EJABBERD_CONFIG_PATH=$1 ; shift ;;
--ctl-config) CONFIG=$1 ; shift ;;
--logs) LOGS_DIR=$1 ; shift ;;
--spool) EJABBERD_DB=$1 ; shift ;;
*) ARGS="$ARGS $PARAM" ;;
esac
done
NAME=-name
[ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && NAME=-sname
ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES"
# define additional environment variables
ERL_INETRC_PATH=$ROOTDIR/etc/ejabberd/inetrc
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
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
export EJABBERD_LOG_PATH
SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log
EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log
SASL_LOG_PATH=$LOGS_DIR/sasl.log
DATETIME=`date "+%Y%m%d-%H%M%S"`
ERL_CRASH_DUMP=$ROOTDIR/var/log/ejabberd/erl_crash.dump.$DATETIME
ERL_CRASH_DUMP=$LOGS_DIR/erl_crash_$DATETIME.dump
HOME=$ROOTDIR/var/lib/ejabberd
# export global variables
export EJABBERD_CONFIG_PATH
export EJABBERD_MSGS_PATH
export EJABBERD_SO_PATH
export ERL_MAX_PORTS
export ERL_MAX_ETS_TABLES
export ERL_CRASH_DUMP
export EJABBERD_LOG_PATH
export HOME
[ $ERL_FULLSWEEP_AFTER = "disabled" ] || export ERL_FULLSWEEP_AFTER
[ -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=-sname
else
SNAME=-name
fi
[ -d $LOGS_DIR ] || mkdir -p $LOGS_DIR
# Compatibility in ZSH
#setopt shwordsplit 2>/dev/null
ERLANG_OPTS="$POLL $SMP $PROCESSES $ERL_MAX_ETS_TABLES -kernel inetrc \""$EJABBERD_INETRC"\" "
# start server
start ()
{
erl \
$SNAME $ERLANG_NODE \
$ERLANG_OPTS \
$NAME $ERLANG_NODE \
-noinput -detached \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-kernel inetrc "\"$ERL_INETRC_PATH\"" \
-s ejabberd \
-sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\}
-sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\} \
$ERLANG_OPTS $ARGS "$@"
}
# attach to server
debug ()
{
echo "--------------------------------------------------------------------"
@ -76,10 +104,13 @@ debug ()
read foo
echo ""
erl \
$SNAME debug \
-remsh $ERLANG_NODE
$NAME ${NODE}debug \
-kernel inetrc \"$ERL_INETRC_PATH\" \
-remsh $ERLANG_NODE \
$ERLANG_OPTS $ARGS "$@"
}
# start interactive server
live ()
{
echo "--------------------------------------------------------------------"
@ -98,45 +129,54 @@ live ()
read foo
echo ""
erl \
$SNAME $ERLANG_NODE \
$NAME $ERLANG_NODE \
$ERLANG_OPTS \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd
-kernel inetrc "\"$ERL_INETRC_PATH\"" \
-s ejabberd \
$ERLANG_OPTS $ARGS "$@"
}
# common control function
ctl ()
{
erl \
$SNAME ejabberdctl \
$NAME ejabberdctl \
-noinput \
-pa $EJABBERD_EBIN \
-kernel inetrc \"$ERL_INETRC_PATH\" \
-s ejabberd_ctl -extra $ERLANG_NODE $@
case $? in
2) help_start;;
3) help_start;;
result=$?
case $result in
0) :;;
*)
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 ""
echo "Optional parameters when starting an ejabberd node:"
echo " --config file Config file of ejabberd: $EJABBERD_CONFIG_PATH"
echo " --ctl-config file Config file of ejabberdctl: $CONFIG"
echo " --logs dir Directory for logs: $LOGS_DIR"
echo " --spool dir Database spool dir: $EJABBERD_DB"
echo "";;
esac
return $result
}
# display ctl usage
usage ()
{
ctl
exit
}
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 $@;;
case $ARGS in
' start') start;;
' debug') debug;;
' live') live;;
*) ctl $ARGS;;
esac