Mention closing #654853 in the changelog
[pkg/ejabberd.git] / debian / scripts / ejabberd
1 #!/bin/sh
3 # define default configuration
4 POLL=false
5 SMP=disable
6 PROCESSES=250000
7 ERL_MAX_PORTS=32000
8 ERL_MAX_ETS_TABLES=1400
9 ERLANG_NODE=ejabberd
11 # Location of the guide.html, for the web administration interface:
12 EJABBERD_DOC_PATH=/usr/share/doc/ejabberd
13 export EJABBERD_DOC_PATH
15 if [ -f /etc/default/ejabberd ] ; then
16     . /etc/default/ejabberd
17 fi
19 if [ "$FIREWALL_WINDOW" = "" ] ; then
20     KERNEL_OPTS=""
21 else
22     KERNEL_OPTS="-kernel \
23         inet_dist_listen_min ${FIREWALL_WINDOW%-*} \
24         inet_dist_listen_max ${FIREWALL_WINDOW#*-}"
25 fi
27 ERLANG_OPTS="+K $POLL -smp $SMP +P $PROCESSES $KERNEL_OPTS"
29 if [ -r /var/lib/ejabberd/.erlang.cookie ] ; then
30     HOME=/var/lib/ejabberd
31     export HOME
32 fi
34 ERL=/usr/bin/erl
35 EBIN_DIR=/usr/lib/ejabberd/ebin
36 CONFIG=/etc/ejabberd/ejabberd.cfg
37 INETRC=/etc/ejabberd/inetrc
38 LOG=/var/log/ejabberd/ejabberd.log
39 ERLANG_LOG=/var/log/ejabberd/erlang.log
40 SPOOL=/var/lib/ejabberd
41 ERL_CRASH_DUMP=/var/log/ejabberd/erl_crash.dump
42 EJABBERD_PID_PATH=/var/run/ejabberd/ejabberd.pid
44 export ERL_CRASH_DUMP
45 export ERL_MAX_PORTS
46 export ERL_MAX_ETS_TABLES
47 export ERL_FULLSWEEP_AFTER
48 export EJABBERD_PID_PATH
51 ARGS=
52 while [ $# -ne 0 ] ; do
53     PARAM=$1
54     shift
55     case $PARAM in
56         --) break ;;
57         --node) ERLANG_NODE=$1; shift ;;
58         --config) CONFIG=$1 ; shift ;;
59         --log) LOG=$1 ; shift ;;
60         --erlang-log) ERLANG_LOG=$1 ; shift ;;
61         --spool) SPOOL=$1 ; shift ;;
62         *) ARGS="$ARGS $PARAM" ;;
63     esac
64 done
66 if [ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] ; then
67     SNAME=-sname
68 else
69     SNAME=-name
70 fi
72 umask 027
74 exec $ERL $SNAME $ERLANG_NODE \
75     -pa $EBIN_DIR \
76     -s ejabberd \
77     -kernel inetrc \"$INETRC\" \
78     -ejabberd config \"$CONFIG\" log_path \"$LOG\" \
79         erlang_log_path \"$ERLANG_LOG\" \
80     -sasl sasl_error_logger false \
81     -mnesia dir \"$SPOOL\" \
82     $ERLANG_OPTS $ERL_OPTIONS $ARGS "$@"