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.
 
 

92 lines
1.8 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
PID_FILE=${PID_FILE:-/var/run/freeswitch/kazoo/freeswitch.pid}
FS_USER=${FS_USER:-freeswitch}
LOCK_FILE=/var/lock/subsys/kazoo-freeswitch
. /etc/init.d/functions
if [ -f /etc/sysconfig/freeswitch ]; then
. /etc/sysconfig/freeswitch
fi
start() {
echo -n "Starting FreeSWITCH: "
if [ -e $LOCK_FILE ]; then
if [ -e $PID_FILE ] && [ -e /proc/`cat $PID_FILE` ]; then
echo
echo -n $"FreeSWITCH is already running.";
failure $"FreeSWITCH is already running.";
echo
return 1
fi
fi
daemon --user $FS_USER --pidfile ${PID_FILE} "/usr/sbin/kazoo-freeswitch start >/dev/null 2>&1"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE;
echo
return $RETVAL
}
stop() {
echo -n "Shutting down FreeSWITCH: "
if [ ! -e $LOCK_FILE ]; then
echo
echo -n $"cannot stop FreeSWITCH: FreeSWITCH is not running."
failure $"cannot stop FreeSWITCH: FreeSWITCH is not running."
echo
return 1;
fi
/usr/sbin/kazoo-freeswitch stop
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE;
return $RETVAL
}
rhstatus() {
status FreeSWITCH;
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status FreeSWITCH
RETVAL=$?
;;
restart)
stop
start
;;
reload)
# <cause the service configuration to be reread, either with
# kill -HUP or by restarting the daemons, in a manner similar
# to restart above>
;;
condrestart)
[ -f $PID_FILE ] && restart || :
;;
*)
echo "Usage: FreeSWITCH {start|stop|status|reload|restart}"
exit 1
;;
esac
exit ${RETVAL}