aboutsummaryrefslogtreecommitdiff
path: root/net-im/jicofo/files/jicofo.in
blob: 238bba7fefc7aa18d6cdffae02c353e8db67daa2 (plain) (blame)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: jicofo
# REQUIRE: NETWORKING SERVERS
# KEYWORD: shutdown
#
# Configuration settings for jicofo in /etc/rc.conf:
#
# jicofo_enable:	run jicofo server (default=NO)
# jicofo_flags:		additional flags for jicofo server (default="")
#

. /etc/rc.subr

name="jicofo"
rcvar=${name}_enable

jicofo_env_file="%%ETCDIR%%/jicofo.conf"
jicofo_jar="%%JAVAJARDIR%%/jicofo.jar"
jicofo_logging_config="%%DATADIR%%/lib/logging.properties"
jicofo_trust_store="%%ETCDIR%%/truststore.jks"

load_rc_config "${name}"

: ${jicofo_enable="NO"}
: ${jicofo_flags=""}

command="%%JAVA%%"
pidfile="/var/run/jicofo.pid"
required_files="${jicofo_env_file} ${jicofo_trust_store}"

start_cmd=${name}_start
stop_cmd=${name}_stop
status_cmd=${name}_status
restart_cmd=${name}_restart

jicofo_start()
{
	daemon -p ${pidfile} -o /var/log/${name}.log \
		${command} -Xmx${MAX_MEMORY} \
                -XX:+HeapDumpOnOutOfMemoryError \
                -XX:HeapDumpPath=/tmp \
                -Djava.util.logging.config.file=${jicofo_logging_config} \
                -Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=%%LOCALBASE%%/etc/jitsi \
                -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=jicofo \
                -Dnet.java.sip.communicator.SC_LOG_DIR_LOCATION=/var/log/ \
		-Djavax.net.ssl.trustStore=${jicofo_trust_store} \
                -cp ${jicofo_jar} \
                org.jitsi.jicofo.Main \
                --host=${JVB_XMPP_HOST} \
                --domain=${JVB_XMPP_DOMAIN} \
                --port=${JVB_XMPP_PORT} \
                --secret=${JVB_XMPP_SECRET} \
		--user_domain=${JVB_XMPP_USER_DOMAIN} \
		--user_name=${JVB_XMPP_USER_NAME} \
		--user_password=${JVB_XMPP_USER_SECRET} ${jicofo_flags}
		echo "Started"
}

jicofo_stop()
{
        if [ -f ${pidfile} ]
        then
                kill `cat ${pidfile}`
                rm ${pidfile}
		echo "Stopped"
        fi
}

jicofo_status()
{
        # If running, show pid
        if [ -f ${pidfile} ]
        then
                echo "${name} is running as pid" `cat ${pidfile}`
        else
                echo "${name} is not running"
        fi
}

jicofo_restart()
{
	echo "Performing restart"
	jicofo_stop
	sleep 5
	jicofo_start
}

run_rc_command "$1"