You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rspamd.init 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/sh
  2. #
  3. # rspamd - this script starts and stops the rspamd daemon
  4. #
  5. # chkconfig: - 85 15
  6. # description: rspamd is a spam filtering system
  7. # processname: rspamd
  8. # config: /etc/rspamd/rspamd.xml
  9. # config: /etc/sysconfig/rspamd
  10. # pidfile: /var/run/rspamd/rspamd.pid
  11. # Source function library.
  12. . /etc/rc.d/init.d/functions
  13. # Source networking configuration.
  14. . /etc/sysconfig/network
  15. # Check that networking is up.
  16. [ "$NETWORKING" = "no" ] && exit 0
  17. rspamd="/usr/bin/rspamd"
  18. prog=$(basename $rspamd)
  19. RSPAMD_CONF_FILE="/etc/rspamd/rspamd"
  20. RSPAMD_USER="rspamd"
  21. RSPAMD_GROUP="rspamd"
  22. [ -f /etc/sysconfig/rspamd ] && . /etc/sysconfig/rspamd
  23. lockfile=/var/lock/subsys/rspamd
  24. start() {
  25. [ -x $rspamd ] || exit 5
  26. [ -f $rspamd_CONF_FILE ] || exit 6
  27. echo -n $"Starting $prog: "
  28. daemon $rspamd -c $RSPAMD_CONF_FILE -u $RSPAMD_USER -g $RSPAMD_GROUP
  29. retval=$?
  30. echo
  31. [ $retval -eq 0 ] && touch $lockfile
  32. return $retval
  33. }
  34. stop() {
  35. echo -n $"Stopping $prog: "
  36. killproc $prog -QUIT
  37. retval=$?
  38. if [ $retval -eq 0 ]; then
  39. if [ "$CONSOLETYPE" != "serial" ]; then
  40. echo -en "\\033[16G"
  41. fi
  42. while rh_status_q
  43. do
  44. sleep 1
  45. echo -n $"."
  46. done
  47. rm -f $lockfile
  48. fi
  49. echo
  50. return $retval
  51. }
  52. restart() {
  53. configtest || return $?
  54. stop
  55. start
  56. }
  57. reload() {
  58. configtest || return $?
  59. echo -n $"Reloading $prog: "
  60. killproc $rspamd -HUP
  61. RETVAL=$?
  62. echo
  63. }
  64. force_reload() {
  65. restart
  66. }
  67. configtest() {
  68. $rspamd -t -c $RSPAMD_CONF_FILE
  69. }
  70. rh_status() {
  71. status $prog
  72. }
  73. rh_status_q() {
  74. rh_status >/dev/null 2>&1
  75. }
  76. case "$1" in
  77. start)
  78. rh_status_q && exit 0
  79. $1
  80. ;;
  81. stop)
  82. rh_status_q || exit 0
  83. $1
  84. ;;
  85. restart|configtest)
  86. $1
  87. ;;
  88. reload)
  89. rh_status_q || exit 7
  90. $1
  91. ;;
  92. force-reload)
  93. force_reload
  94. ;;
  95. status)
  96. rh_status
  97. ;;
  98. condrestart|try-restart)
  99. rh_status_q || exit 0
  100. ;;
  101. *)
  102. echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
  103. exit 2
  104. esac