Guest User

/etc/rc.d/init.d/murmur

a guest
Feb 28th, 2015
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #
  3. # /etc/rc.d/init.d/murmur
  4. #
  5. # starts the murmur voip server
  6. #
  7. # chkconfig: - 95 80
  8. # description: murmur is the server for the Mumble voip suite aimed at gamers
  9. # processname: murmur
  10. # config: /etc/murmur.ini
  11. # pidfile: /var/run/murmur/murmur.pid
  12.  
  13. . /etc/rc.d/init.d/functions
  14.  
  15. prog=/usr/local/murmur/murmur.x86
  16. lockfile=/var/run/murmur/murmur.pid
  17. RETVAL=0
  18. INIFILE=/etc/murmur.ini
  19. MURMUR_USER=murmur
  20. MURMUR_GROUP=murmur
  21. MURMUR_OPTS="-ini $INIFILE"
  22.  
  23. start() {
  24. echo -n "Starting murmur: "
  25.  
  26. status $prog &> /dev/null # Mumble-server is running
  27. RETVAL=$?
  28. if [ $RETVAL -eq 0 ]; then
  29. success
  30. echo
  31. return $RETVAL
  32. fi
  33.  
  34. daemon "$prog $MURMUR_OPTS"
  35. RETVAL=$?
  36. if [ $RETVAL -eq 0 ]; then
  37. touch "$lockfile" && success || failure
  38. fi
  39. echo
  40. return $RETVAL
  41. }
  42.  
  43. stop() {
  44. echo -n "Shutting down murmur: "
  45. killproc $prog -INT
  46. RETVAL=$?
  47. if [ $RETVAL -eq 0 ]; then
  48. /bin/rm "$lockfile" 2> /dev/null && success || failure
  49. fi
  50. echo
  51. return $RETVAL
  52. }
  53.  
  54. restart() {
  55. stop
  56. start
  57. }
  58.  
  59. case "$1" in
  60. start)
  61. start
  62. ;;
  63. stop)
  64. stop
  65. ;;
  66. status)
  67. status $prog
  68. RETVAL=$?
  69. ;;
  70. restart|force-reload)
  71. restart
  72. ;;
  73. reload)
  74. ;;
  75. condrestart)
  76. [ -f "$lockfile" ] && restart
  77. ;;
  78. *)
  79. echo "Usage: <servicename> {start|stop|status|restart|reload|force-reload|condrestart}"
  80. exit 1
  81. ;;
  82. esac
  83. exit $RETVAL
RAW Paste Data