summaryrefslogtreecommitdiffstats
path: root/system/freeswitch/rc.freeswitch
diff options
context:
space:
mode:
Diffstat (limited to 'system/freeswitch/rc.freeswitch')
-rw-r--r--system/freeswitch/rc.freeswitch71
1 files changed, 71 insertions, 0 deletions
diff --git a/system/freeswitch/rc.freeswitch b/system/freeswitch/rc.freeswitch
new file mode 100644
index 0000000000..fd3925dff4
--- /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