diff --git a/system/init.d/kazoo-freeswitch.redhat b/system/init.d/kazoo-freeswitch.redhat new file mode 100755 index 0000000..5c08022 --- /dev/null +++ b/system/init.d/kazoo-freeswitch.redhat @@ -0,0 +1,103 @@ +#!/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 +# + +# Source function library. +. /etc/init.d/functions + +PROG_NAME=freeswitch +PID_FILE=${PID_FILE-/var/run/freeswitch/kazoo-freeswitch.pid} +FS_USER=${FS_USER-freeswitch} +FS_FILE=${FS_FILE-/usr/bin/freeswitch} +FS_HOME=${FS_HOME-/var/run/kazoo-freeswitch} +LOCK_FILE=/var/lock/subsys/freeswitch +FREESWITCH_ARGS="-ncwait -nonat -conf /etc/kazoo/freeswitch -db /var/lib/kazoo-freeswitch/db -log /var/log/freeswitch/kazoo" +RETVAL=0 + +# Source usr/localions file +if [ -f /etc/sysconfig/freeswitch ]; then + . /etc/sysconfig/freeswitch +fi + +# + +start() { + echo -n "Starting $PROG_NAME: " + if [ -e $LOCK_FILE ]; then + if [ -e $PID_FILE ] && [ -e /proc/`cat $PID_FILE` ]; then + echo + echo -n $"$PROG_NAME is already running."; + failure $"$PROG_NAME is already running."; + echo + return 1 + fi + fi + cd $FS_HOME + daemon --user $FS_USER --pidfile $PID_FILE "$FS_FILE $FREESWITCH_ARGS $FREESWITCH_PARAMS >/dev/null 2>&1" + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCK_FILE; + echo + return $RETVAL +} + +stop() { + echo -n "Shutting down $PROG_NAME: " + if [ ! -e $LOCK_FILE ]; then + echo + echo -n $"cannot stop $PROG_NAME: $PROG_NAME is not running." + failure $"cannot stop $PROG_NAME: $PROG_NAME is not running." + echo + return 1; + fi + cd $FS_HOME + $FS_FILE -stop > /dev/null 2>&1 + killproc $PROG_NAME + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE; + return $RETVAL +} + +rhstatus() { + status $PROG_NAME; +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $PROG_NAME + RETVAL=$? + ;; + restart) + stop + start + ;; + reload) +# + ;; + condrestart) + [ -f $PID_FILE ] && restart || : + ;; + *) + echo "Usage: $PROG_NAME {start|stop|status|reload|restart}" + exit 1 + ;; +esac +exit $RETVAL diff --git a/system/init.d/kazoo-generic b/system/init.d/kazoo-generic.redhat similarity index 100% rename from system/init.d/kazoo-generic rename to system/init.d/kazoo-generic.redhat diff --git a/system/init.d/kazoo-haproxy b/system/init.d/kazoo-haproxy.redhat similarity index 100% rename from system/init.d/kazoo-haproxy rename to system/init.d/kazoo-haproxy.redhat