summaryrefslogtreecommitdiffstats
path: root/testing/freeswitch/freeswitch.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/freeswitch/freeswitch.initd')
-rwxr-xr-x[-rw-r--r--]testing/freeswitch/freeswitch.initd40
1 files changed, 27 insertions, 13 deletions
diff --git a/testing/freeswitch/freeswitch.initd b/testing/freeswitch/freeswitch.initd
index 34f441390..84381d771 100644..100755
--- a/testing/freeswitch/freeswitch.initd
+++ b/testing/freeswitch/freeswitch.initd
@@ -1,19 +1,33 @@
#!/sbin/runscript
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: $
-NAME=freeswitch
-USER=freeswitch
-DAEMON=/usr/bin/freeswitch
-OPTIONS_START="-u $USER -g $GROUP -nc"
-OPTIONS_STOP="-stop"
+depend() {
+ need net
+}
start() {
- ebegin "Starting $NAME"
- $DAEMON $OPTIONS_START
- eend 0
- }
+ 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"
+ start-stop-daemon --start --quiet --exec /usr/bin/freeswitch \
+ --pidfile /var/run/freeswitch.pid -- -nc ${OPTS}
+ eend $?
+}
stop() {
- ebegin "Stopping $NAME"
- $DAEMON $OPTIONS_STOP
- eend 0
- }
+ ebegin "Stopping Freeswitch"
+ start-stop-daemon --stop --quiet --pidfile /var/run/freeswitch.pid
+ eend $?
+}
+