2
0

fs_ivrd.init.redhat 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/bash
  2. #
  3. # /etc/rc.d/init.d/fs_ivrd
  4. #
  5. # The FreeSwitch Open Source Voice Platform
  6. #
  7. # chkconfig: 345 89 14
  8. # description: Starts and stops the fs_ivrd server daemon
  9. # processname: fs_ivrd
  10. # pidfile: /usr/local/fs_ivrd/run/fs_ivrd.pid
  11. #
  12. # Source function library.
  13. . /etc/init.d/functions
  14. PROG_NAME=fs_ivrd
  15. PID_FILE=${PID_FILE-/usr/local/freeswitch/run/fs_ivrd.pid}
  16. #FS_USER=${FS_USER-freeswitch}
  17. FS_USER=${FS_USER-root}
  18. FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/fs_ivrd}
  19. FS_HOME=${FS_HOME-/usr/local/freeswitch}
  20. LOCK_FILE=/var/lock/subsys/fs_ivrd
  21. IVRD_ARGS="-h localhost -p 9090"
  22. RETVAL=0
  23. # Source options file
  24. if [ -f /etc/sysconfig/fs_ivrd ]; then
  25. . /etc/sysconfig/fs_ivrd
  26. fi
  27. # <define any local shell functions used by the code that follows>
  28. start() {
  29. echo -n "Starting $PROG_NAME: "
  30. if [ -e $LOCK_FILE ]; then
  31. if [ -e $PID_FILE ] && [ -e /proc/`cat $PID_FILE` ]; then
  32. echo
  33. echo -n $"$PROG_NAME is already running.";
  34. failure $"$PROG_NAME is already running.";
  35. echo
  36. return 1
  37. fi
  38. fi
  39. cd $FS_HOME
  40. daemon --user $FS_USER --pidfile $PID_FILE "$FS_FILE $IVRD_ARGS $IVRD_PARAMS >/dev/null 2>&1 &"
  41. echo
  42. RETVAL=$?
  43. [ $RETVAL -eq 0 ] && touch $LOCK_FILE;
  44. echo
  45. return $RETVAL
  46. }
  47. stop() {
  48. echo -n "Shutting down $PROG_NAME: "
  49. if [ ! -e $LOCK_FILE ]; then
  50. echo
  51. echo -n $"cannot stop $PROG_NAME: $PROG_NAME is not running."
  52. failure $"cannot stop $PROG_NAME: $PROG_NAME is not running."
  53. echo
  54. return 1;
  55. fi
  56. cd $FS_HOME
  57. $FS_FILE -stop > /dev/null 2>&1
  58. killproc $PROG_NAME
  59. RETVAL=$?
  60. echo
  61. [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE;
  62. return $RETVAL
  63. }
  64. rhstatus() {
  65. status $PROG_NAME;
  66. }
  67. case "$1" in
  68. start)
  69. start
  70. ;;
  71. stop)
  72. stop
  73. ;;
  74. status)
  75. status $PROG_NAME
  76. RETVAL=$?
  77. ;;
  78. restart)
  79. stop
  80. start
  81. ;;
  82. reload)
  83. # <cause the service configuration to be reread, either with
  84. # kill -HUP or by restarting the daemons, in a manner similar
  85. # to restart above>
  86. ;;
  87. condrestart)
  88. ;;
  89. *)
  90. echo "Usage: $PROG_NAME {start|stop|status|restart}"
  91. exit 1
  92. ;;
  93. esac
  94. exit $RETVAL