1#!/bin/bash
2
3if [[ "$1" == "--help"  || $# -lt 1 ]]; then
4    echo -e "Usage:"
5    echo -e "$0 [OPTIONS], where options can be:"
6    echo -e "\t--secret=SECRET\t sets the shared secret used to authenticate to the XMPP server"
7    echo -e "\t--domain=DOMAIN\t sets the XMPP domain (default: none)"
8    echo -e "\t--host=HOST\t sets the hostname of the XMPP server (default: domain, if domain is set, \"localhost\" otherwise)"
9    echo -e "\t--port=PORT\t sets the port of the XMPP server (default: 5275)"
10    echo -e "\t--subdomain=SUBDOMAIN\t sets the sub-domain used to bind JVB XMPP component (default: jitsi-videobridge)"
11    echo -e "\t--apis=APIS where APIS is a comma separated list of APIs to enable. Currently supported APIs are 'xmpp' and 'rest'. The default is 'xmpp'."
12    echo
13    exit 1
14fi
15
16SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
17
18mainClass="org.jitsi.videobridge.Main"
19cp=$SCRIPT_DIR/jitsi-videobridge.jar:$SCRIPT_DIR/lib/*
20logging_config="$SCRIPT_DIR/lib/logging.properties"
21videobridge_rc="$SCRIPT_DIR/lib/videobridge.rc"
22
23# if there is a logging config file in lib folder use it (running from source)
24if [ -f $logging_config ]; then
25    LOGGING_CONFIG_PARAM="-Djava.util.logging.config.file=$logging_config"
26fi
27
28if [ -f $videobridge_rc  ]; then
29        source $videobridge_rc
30fi
31
32if [ -z "$VIDEOBRIDGE_MAX_MEMORY" ]; then VIDEOBRIDGE_MAX_MEMORY=3072m; fi
33
34exec java -Xmx$VIDEOBRIDGE_MAX_MEMORY $VIDEOBRIDGE_DEBUG_OPTIONS -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp $LOGGING_CONFIG_PARAM $JAVA_SYS_PROPS -cp $cp $mainClass $@
35