summaryrefslogtreecommitdiff
blob: 89f3ff4824e3a621310060f75489d62decfb6d39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh

[ -f /etc/conf.d/ejabberd ] && . /etc/conf.d/ejabberd

# provide some default configuration
ERL=/usr/bin/erl
CONFIG=/etc/jabber/ejabberd.cfg
INETRC=/etc/jabber/inetrc
LOG_PATH=/var/log/jabber/ejabberd.log
SASL_LOG=/var/log/jabber/sasl.log
SPOOL=/var/spool/jabber

ARGS=
while [ $# -ne 0 ] ; do
    PARAM=$1
    shift
    case $PARAM in
	--) break ;;
	--node) EJABBERD_NODE=$1; shift ;;
	--config) CONFIG=$1 ; shift ;;
	--log) LOG_PATH=$1 ; shift ;;
	--sasl-log) SASL_LOG=$1 ; shift ;;
	--spool) SPOOL=$1 ; shift ;;
	*) ARGS="$ARGS $PARAM" ;;
    esac
done

if [ "$EJABBERD_NODE" = "${EJABBERD_NODE%.*}" ] ; then
    SNAME=-sname
else
    SNAME=-name
fi

# export ejabberd configuration environment variables
export HOME=/var/run/jabber
export EJABBERD_EBIN=/usr/@libdir@/erlang/lib/ejabberd-@version@/ebin
export EJABBERD_MSGS_PATH=/usr/@libdir@/erlang/lib/ejabberd-@version@/priv/msgs
export EJABBERD_SO_PATH=/usr/@libdir@/erlang/lib/ejabberd-@version@/priv/lib
export EJABBERD_LOG_PATH=$LOG_PATH
export EJABBERD_CONFIG_PATH=$CONFIG

exec $ERL $SNAME $EJABBERD_NODE \
    -s ejabberd \
    -kernel inetrc \"$INETRC\" \
    -sasl sasl_error_logger \{file,\"$SASL_LOG\"\} \
    -mnesia dir \"$SPOOL\" \
    $ERL_OPTIONS $ARGS "$@"