#!/bin/bash
|
|
#
|
|
# /etc/rc.d/init.d/freeswitch
|
|
#
|
|
# The FreeSWITCH Open Source Voice Platform
|
|
#
|
|
# chkconfig: 345 89 14
|
|
# description: Starts and stops the freeswitch server daemon
|
|
# processname: freeswitch
|
|
# config: /etc/kazoo/freeswitch/freeswitch.xml
|
|
# pidfile: /var/run/freeswitch/kazoo-freeswitch.pid
|
|
#
|
|
|
|
RETVAL=0
|
|
LOCK_FILE=/var/lock/subsys/kazoo-freeswitch
|
|
|
|
. /etc/init.d/functions
|
|
|
|
start() {
|
|
echo -n "Starting FreeSWITCH: "
|
|
/usr/sbin/kazoo-freeswitch prepare >/dev/null 2>&1
|
|
daemon "/usr/sbin/kazoo-freeswitch background >/dev/null 2>&1"
|
|
RETVAL=$?
|
|
if [ ${RETVAL} -eq 0 ]; then
|
|
touch ${LOCK_FILE}
|
|
success $"OK"
|
|
echo
|
|
else
|
|
failure $"FreeSWITCH is already running or failed to start!"
|
|
echo
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
echo -n "Shutting down FreeSWITCH: "
|
|
/usr/sbin/kazoo-freeswitch stop >/dev/null 2>&1
|
|
RETVAL=$?
|
|
if [ ${RETVAL} -eq 0 ]; then
|
|
rm -f ${LOCK_FILE} ${pidfile}
|
|
success $"OK"
|
|
echo
|
|
else
|
|
failure $"FreeSWITCH is still running!"
|
|
echo
|
|
fi
|
|
}
|
|
|
|
status() {
|
|
/usr/sbin/kazoo-freeswitch status
|
|
RETVAL=$?
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
status
|
|
;;
|
|
restart|reload)
|
|
restart
|
|
;;
|
|
condrestart)
|
|
[ ! -e ${LOCK_FILE} ] && restart
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 (start|stop|restart|status)"
|
|
RETVAL=1
|
|
esac
|
|
|
|
exit ${RETVAL}
|