git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7930 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-03-19 16:56:24 +00:00
parent 11d03864ad
commit bd07c59de3
1 changed files with 18 additions and 17 deletions

View File

@ -5,6 +5,7 @@
# The FreeSwitch Open Source Voice Platform # The FreeSwitch Open Source Voice Platform
# #
# chkconfig: - 89 14 # chkconfig: - 89 14
# description: Starts and stops the freeswitch server daemon
# processname: freeswitch # processname: freeswitch
# config: /opt/freeswitch/conf/freeswitch.conf # config: /opt/freeswitch/conf/freeswitch.conf
# pidfile: /opt/freeswitch/log/freeswitch.pid # pidfile: /opt/freeswitch/log/freeswitch.pid
@ -19,19 +20,19 @@ if [ -f /etc/sysconfig/freeswitch ]; then
. /etc/sysconfig/freeswitch . /etc/sysconfig/freeswitch
fi fi
prog=freeswitch PROG_NAME=freeswitch
pidfile=/opt/freeswitch/log/freeswitch.pid PID_FILE=/opt/freeswitch/log/freeswitch.pid
FS_USER=freeswitch FS_USER=freeswitch
FS_FILE=/opt/freeswitch/bin/freeswitch FS_FILE=/opt/freeswitch/bin/freeswitch
lockfile=/var/lock/subsys/freeswitch LOCK_FILE=/var/lock/subsys/freeswitch
RETVAL=0 RETVAL=0
# <define any local shell functions used by the code that follows> # <define any local shell functions used by the code that follows>
start() { start() {
echo -n "Starting $prog: " echo -n "Starting $PROG_NAME: "
if [ -e $lockfile ]; then if [ -e $LOCK_FILE ]; then
if [ -e $pidfile ] && [ -e /proc/`$pidfile` ]; then if [ -e $PID_FILE ] && [ -e /proc/`$PID_FILE` ]; then
echo -n $"cannot start freeswitch: freeswitch is already running."; echo -n $"cannot start freeswitch: freeswitch is already running.";
failure $"cannot start freeswitch: freeswitch already running."; failure $"cannot start freeswitch: freeswitch already running.";
echo echo
@ -39,18 +40,18 @@ start() {
fi fi
fi fi
daemon --user $FS_USER --pidfile $pidfile "$FS_FILE $FREESWITCH_PARAMS >/dev/null 2>&1" daemon --user $FS_USER --pidfile $PID_FILE "$FS_FILE $FREESWITCH_PARAMS >/dev/null 2>&1"
echo echo
RETVAL=$? RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile; [ $RETVAL -eq 0 ] && touch $LOCK_FILE;
return $RETVAL return $RETVAL
} }
stop() { stop() {
echo -n "Shutting down $prog: " echo -n "Shutting down $PROG_NAME: "
if [ ! -e $lockfile ]; then if [ ! -e $LOCK_FILE ]; then
echo -n $"cannot stop $prog: $prog is not running." echo -n $"cannot stop $PROG_NAME: $PROG_NAME is not running."
failure $"cannot stop $prog: $prog is not running." failure $"cannot stop $PROG_NAME: $PROG_NAME is not running."
echo echo
return 1; return 1;
fi fi
@ -58,12 +59,12 @@ stop() {
killproc freeswitch killproc freeswitch
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL -eq 0 ] && rm -f $lockfile; [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE;
return $RETVAL return $RETVAL
} }
rhstatus() { rhstatus() {
status $prog; status $PROG_NAME;
} }
case "$1" in case "$1" in
@ -74,7 +75,7 @@ case "$1" in
stop stop
;; ;;
status) status)
status $prog status $PROG_NAME
RETVAL=$? RETVAL=$?
;; ;;
restart) restart)
@ -87,10 +88,10 @@ case "$1" in
# to restart above> # to restart above>
;; ;;
condrestart) condrestart)
[ -f $pidfile ] && restart || : [ -f $PID_FILE ] && restart || :
;; ;;
*) *)
echo "Usage: $prog {start|stop|status|reload|restart" echo "Usage: $PROG_NAME {start|stop|status|reload|restart"
exit 1 exit 1
;; ;;
esac esac