aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeswitch/freeswitch.initd
blob: 91df7e2acf4302ff35e64586725403f6af73496b (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/sbin/runscript
# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: $

depend() {
	need net
}

opts="reload"
pidfile=/var/run/freeswitch/freeswitch.pid

start() {
	local OPTS

	[ -n "${FREESWITCH_USER}" ] && \
		OPTS="${OPTS} -u ${FREESWITCH_USER}"

	[ -n "${FREESWITCH_GROUP}" ] && \
		OPTS="${OPTS} -g ${FREESWITCH_GROUP}"

	[ -n "${FREESWITCH_OPTS}" ] && \
		OPTS="${OPTS} ${FREESWITCH_OPTS}"

	ebegin "Starting Freeswitch"
	limits
	start-stop-daemon --start --quiet --exec /usr/bin/freeswitch \
		-- \
		-nc -conf /etc/freeswitch -log /var/log/freeswitch \
		-run /var/run/freeswitch -db /var/lib/freeswitch/db \
		-htdocs /usr/share/freeswitch/htdocs \
		-scripts /usr/share/freeswitch/scripts ${OPTS}
	eend $?
}

# Recomended ULIMIT settings
# http://tinyurl.com/2dr467l (i,q,u,x not suppoted)

limits() {
	ulimit -c unlimited
	ulimit -d unlimited
	ulimit -f unlimited
	ulimit -n 999999
	ulimit -v unlimited
	ulimit -s 244
	ulimit -l unlimited
}

stop() {
	ebegin "Stopping Freeswitch"
	start-stop-daemon --quiet --stop \
		--pidfile $pidfile \
		--retry 10 \
		--exec /usr/bin/freeswitch
	eend $?
}

reload() {
	start-stop-daemon --stop --signal 1 --quiet \
		--pidfile $pidfile --name freeswitch
	return 0
}