ejabberd 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh
  2. #
  3. # ejabberd XMPP server
  4. #
  5. # chkconfig: - 70 30
  6. # description: Fault-tolerant XMPP server.
  7. #
  8. # processname: so many
  9. # config: /etc/ejabberd/ejabberd.cfg
  10. # pidfile: nope
  11. WITHOUT_RC_COMPAT=1
  12. # Source function library.
  13. . /lib/lsb/init-functions
  14. LOCKFILE=/var/lock/ejabberdctl
  15. RETVAL=0
  16. start()
  17. {
  18. echo "Starting ejabberd service: "
  19. su -s /bin/sh -c '/usr/sbin/ejabberdctl start' -l ejabberd
  20. RETVAL=$?
  21. [ "$RETVAL" -ne 0 ] || touch "$LOCKFILE"
  22. return $RETVAL
  23. }
  24. stop()
  25. {
  26. echo "Stopping ejabberd service: "
  27. su -s /bin/sh -c '/usr/sbin/ejabberdctl stop' -l ejabberd
  28. RETVAL=$?
  29. [ $RETVAL -eq 0 ] || return
  30. sleep 3
  31. echo "Stopping erlang portmapper: "
  32. epmd -kill
  33. RETVAL=$?
  34. [ "$RETVAL" -ne 0 ] || rm -f -- "$LOCKFILE"
  35. return $RETVAL
  36. }
  37. restart()
  38. {
  39. stop
  40. sleep 2
  41. start
  42. }
  43. status()
  44. {
  45. ejabberdctl status
  46. RETVAL=$?
  47. return $RETVAL
  48. }
  49. case "$1" in
  50. start)
  51. start
  52. ;;
  53. stop)
  54. stop
  55. ;;
  56. restart|reload)
  57. restart
  58. ;;
  59. condstop)
  60. if [ -e "$LOCKFILE" ]; then
  61. stop
  62. fi
  63. ;;
  64. condrestart|condreload)
  65. if [ -e "$LOCKFILE" ]; then
  66. restart
  67. fi
  68. ;;
  69. status)
  70. status
  71. ;;
  72. *)
  73. msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
  74. RETVAL=1
  75. ;;
  76. esac
  77. exit $RETVAL