From c1da705ed364b4544f1b1e53f23dec9189efe07b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mesquita?= Date: Sat, 13 Mar 2010 22:23:54 +0000 Subject: [PATCH] fs_ivrd init script for redhat/centos. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16981 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- build/fs_ivrd.init.redhat | 102 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 build/fs_ivrd.init.redhat diff --git a/build/fs_ivrd.init.redhat b/build/fs_ivrd.init.redhat new file mode 100644 index 0000000000..4122ce8f98 --- /dev/null +++ b/build/fs_ivrd.init.redhat @@ -0,0 +1,102 @@ +#!/bin/bash +# +# /etc/rc.d/init.d/fs_ivrd +# +# The FreeSwitch Open Source Voice Platform +# +# chkconfig: 345 89 14 +# description: Starts and stops the fs_ivrd server daemon +# processname: fs_ivrd +# pidfile: /usr/local/fs_ivrd/run/fs_ivrd.pid +# + +# Source function library. +. /etc/init.d/functions + +PROG_NAME=fs_ivrd +PID_FILE=${PID_FILE-/usr/local/freeswitch/run/fs_ivrd.pid} +#FS_USER=${FS_USER-freeswitch} +FS_USER=${FS_USER-root} +FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/fs_ivrd} +FS_HOME=${FS_HOME-/usr/local/freeswitch} +LOCK_FILE=/var/lock/subsys/fs_ivrd +IVRD_ARGS="-h localhost -p 9090" +RETVAL=0 + +# Source options file +if [ -f /etc/sysconfig/fs_ivrd ]; then + . /etc/sysconfig/fs_ivrd +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 $IVRD_ARGS $IVRD_PARAMS >/dev/null 2>&1 &" + echo + RETVAL=$? + [ $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) + ;; + *) + echo "Usage: $PROG_NAME {start|stop|status|restart}" + exit 1 + ;; +esac +exit $RETVAL