summaryrefslogtreecommitdiffstats
path: root/net/ejabberd/files/ejabberd.in
blob: f97ec26fb21501a616083c2aab16228eed703e41 (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
#!/bin/sh

[ -f %%PREFIX%%/etc/%%PORTNAME%%/%%PORTNAME%%.defaults ] && . %%PREFIX%%/etc/%%PORTNAME%%/%%PORTNAME%%.defaults

CONFIG=%%PREFIX%%/etc/%%PORTNAME%%/%%PORTNAME%%.cfg
INETRC=%%PREFIX%%/etc/%%PORTNAME%%/%%PORTNAME%%.inetrc
LOG=/var/log/%%PORTNAME%%/%%PORTNAME%%.log
SASL_LOG=/var/log/%%PORTNAME%%/sasl.log
SPOOL=/var/spool/%%PORTNAME%%

ARGS=

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

cd $SPOOL &&
exec erl +K true -sname %%PORTNAME%% \
    -s %%PORTNAME%% \
    -%%PORTNAME%% config \"$CONFIG\" log_path \"$LOG\" \
    -sasl sasl_error_logger \{file,\"$SASL_LOG\"\} \
    -mnesia dir \"$SPOOL\" \
    -kernel inetrc \"${INETRC}\" \
    $ERL_OPTIONS $ARGS "$@"

OpenPOWER on IntegriCloud