Permalink
Browse files

* 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
  • Loading branch information...
1 parent c7e9fe1 commit b23d82bc1eeae38194fdb38c8a818be372344d50 @badlop badlop committed Jan 1, 2008
Showing with 132 additions and 73 deletions.
  1. +18 −1 ChangeLog
  2. +3 −3 doc/guide.tex
  3. +1 −1 src/Makefile.in
  4. +15 −13 src/ejabberdctl.cfg.example
  5. +95 −55 src/ejabberdctl.template
  6. 0 src/{ejabberd.inetrc → inetrc}
View
@@ -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
@@ -307,8 +307,8 @@ \subsection{Install}
\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 @@ \subsection{Install}
\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 @@ \subsection{Erlang configuration}
\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
@@ -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)
@@ -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,20 +21,20 @@
# 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
#
# ejabberd consumes two or three ports for every connection, either
# 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
@@ -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
-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
-DATETIME=`date "+%Y%m%d-%H%M%S"`
-ERL_CRASH_DUMP=$ROOTDIR/var/log/ejabberd/erl_crash.dump.$DATETIME
-export ERL_CRASH_DUMP
-[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB
+# 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
-[ -f $EJABBERDCTL_CFG ] && . $EJABBERDCTL_CFG
+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=$LOGS_DIR/ejabberd.log
+SASL_LOG_PATH=$LOGS_DIR/sasl.log
+DATETIME=`date "+%Y%m%d-%H%M%S"`
+ERL_CRASH_DUMP=$LOGS_DIR/erl_crash_$DATETIME.dump
HOME=$ROOTDIR/var/lib/ejabberd
-export HOME
-if [ $# -ne 0 ] ; then
- case $1 in
- --node) shift ; ERLANG_NODE=$1 ; shift ;;
- esac
-fi
+# 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
-if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
- SNAME=-sname
-else
- SNAME=-name
-fi
+[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB
+[ -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
File renamed without changes.

0 comments on commit b23d82b

Please sign in to comment.