G2A Many GEOs
SHARE
TWEET

Freeswitch init script (CentOS 5.9)

rgiapratama May 18th, 2013 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #
  3. #       /etc/rc.d/init.d/freeswitch
  4. #
  5. #       The FreeSwitch Open Source Voice Platform
  6. #
  7. #  chkconfig: 345 89 14
  8. #  description: Starts and stops the freeswitch server daemon
  9. #  processname: freeswitch
  10. #  config: /usr/local/freeswitch/conf/freeswitch.conf
  11. #  pidfile: /usr/local/freeswitch/run/freeswitch.pid
  12. #
  13.  
  14. # Source function library.
  15. . /etc/init.d/functions
  16.  
  17. PROG_NAME=freeswitch
  18. PID_FILE=${PID_FILE-/opt/freeswitch/run/freeswitch.pid}
  19. FS_USER=${FS_USER-freeswitch}
  20. FS_FILE=${FS_FILE-/opt/freeswitch/bin/freeswitch}
  21. FS_HOME=${FS_HOME-/opt/freeswitch}
  22. LOCK_FILE=/var/lock/subsys/freeswitch
  23. FREESWITCH_ARGS="-nc"
  24. RETVAL=0
  25.  
  26. # Source usr/localions file
  27. if [ -f /etc/sysconfig/freeswitch ]; then
  28.         . /etc/sysconfig/freeswitch
  29. fi
  30.  
  31. # <define any local shell functions used by the code that follows>
  32.  
  33. start() {
  34.         echo -n "Starting $PROG_NAME: "
  35.         if [ -e $LOCK_FILE ]; then
  36.             if [ -e $PID_FILE ] && [ -e /proc/`cat $PID_FILE` ]; then
  37.                 echo
  38.                 echo -n $"$PROG_NAME is already running.";
  39.                 failure $"$PROG_NAME is already running.";
  40.                 echo
  41.                 return 1
  42.             fi
  43.         fi
  44.         cd $FS_HOME
  45.         daemon --user $FS_USER --pidfile $PID_FILE "$FS_FILE $FREESWITCH_ARGS $FREESWITCH_PARAMS >/dev/null 2>&1"
  46.                 RETVAL=$?
  47.                 echo
  48.         [ $RETVAL -eq 0 ] && touch $LOCK_FILE;
  49.         echo
  50.         return $RETVAL
  51. }
  52.  
  53. stop() {
  54.         echo -n "Shutting down $PROG_NAME: "
  55.         if [ ! -e $LOCK_FILE ]; then
  56.             echo
  57.             echo -n $"cannot stop $PROG_NAME: $PROG_NAME is not running."
  58.             failure $"cannot stop $PROG_NAME: $PROG_NAME is not running."
  59.             echo
  60.             return 1;
  61.         fi
  62.         cd $FS_HOME
  63.         $FS_FILE -stop > /dev/null 2>&1
  64.         killproc $PROG_NAME
  65.         RETVAL=$?
  66.         echo
  67.         [ $RETVAL -eq 0 ] &&  rm -f $LOCK_FILE;
  68.         return $RETVAL
  69. }
  70.  
  71. rhstatus() {
  72.         status $PROG_NAME;
  73. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top