You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

79 lines
1.7 KiB

#!/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"
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}