diff options
author | mario <mario@slackverse.org> | 2013-06-03 17:33:01 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2013-06-04 00:11:33 -0500 |
commit | 1cea6afdc176c7a08e57adf112dd6d699742ba24 (patch) | |
tree | 9ac81a67b177706305834f9f31dc8b56141b37fb /system/freeswitch/rc.freeswitch | |
parent | ca77a5a0a0bd68537c6f629c84519b26c10a23d1 (diff) |
system/freeswitch: Added (Open source telephony platform)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/freeswitch/rc.freeswitch')
-rw-r--r-- | system/freeswitch/rc.freeswitch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/system/freeswitch/rc.freeswitch b/system/freeswitch/rc.freeswitch new file mode 100644 index 0000000000000..fd3925dff40d8 --- /dev/null +++ b/system/freeswitch/rc.freeswitch @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Start/stop/restart FreeSWITCH for Slackware +# +# Copyright 2013, mario <mario@slackverse.org> + +USER=freeswitch +GROUP=freeswitch +BIN_FILE=/opt/freeswitch/bin/freeswitch +PID_FILE=/var/run/freeswitch/freeswitch.pid +RUN_ARGS="-nc -rp -nonat" + +set_limits() { + ulimit -c unlimited + ulimit -d unlimited + ulimit -f unlimited + ulimit -i unlimited + ulimit -n 999999 + ulimit -q unlimited + ulimit -u unlimited + ulimit -v unlimited + ulimit -x unlimited + ulimit -s 240 + ulimit -l unlimited +} + +start() { + echo -n "Starting FreeSWITCH: " + if [ -e $PID_FILE ] && [ -e /proc/$(cat $PID_FILE) ]; then + echo "Already running." + else + set_limits + $BIN_FILE $RUN_ARGS -u $USER -g $GROUP >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "Started." + else + echo "Failed starting." + fi + fi +} + +stop() { + echo -n "Stopping FreeSWITCH: " + if [ -e $PID_FILE ] && [ -e /proc/$(cat $PID_FILE) ]; then + $BIN_FILE -stop >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "Stopped." + else + echo "Failed stopping." + fi + else + echo "Not running." + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + sleep 5 + start + ;; + *) + echo "USAGE: $0 {start|stop|restart}" + ;; +esac |