aports/main/freeswitch/freeswitch.initd
2013-05-23 14:34:57 +00:00

67 lines
1.4 KiB
Plaintext
Executable File

#!/sbin/runscript
# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: $
depend() {
need net
}
extra_started_commands="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}"
checkpath -q -d \
-o ${FREESWITCH_USER:-freeswitch}:${FREESWITCH_GROUP:-freeswitch}\
-m 0770 /var/run/freeswitch
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 /etc/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 240
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
}