[packages]: net/freeswitch: Added initial uci configuration capability.
[openwrt/svn-archive/archive.git] / net / freeswitch / files / freeswitch.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3 START=90
4
5 DEFAULT=/etc/default/freeswitch
6 OPTIONS=""
7
8 boot() {
9 # Do nothing on boot
10 exit 0
11 }
12
13 start() {
14 [ -f $DEFAULT ] && . $DEFAULT
15 mkdir -p $FS_DIR_DB
16 mkdir -p $FS_DIR_LOG
17 ulimit -s 240
18 include /usr/lib/freeswitch/uci
19 fs_init_xml
20 $FS_DIR/usr/bin/freeswitch $OPTIONS -nc
21 }
22
23 stop() {
24 [ -f $DEFAULT ] && . $DEFAULT
25 $FS_DIR/usr/bin/freeswitch $OPTIONS -stop
26 }
27
28 restart() {
29 # stopping freeswitch is non-blocking, so we wait until freeswitch's
30 # event socket is down, and then wait an additional ten seconds so that
31 # freeswitch should be completely shutdown before we start it again
32 local retval
33 stop
34 fs_cli -x status >/dev/null 2>&1
35 retval=$?
36 while [ $retval -eq 0 ]; do sleep 1; fs_cli -x status >/dev/null 2>&1; retval=$?; done
37 sleep 10
38 start
39 }
40