您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

postsrsd.sysv-redhat.in 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #! /bin/sh
  2. #
  3. # @PROJECT_NAME@
  4. # start/stop the @PROJECT_NAME@ daemon for Postfix
  5. #
  6. # chkconfig: 2345 75 35
  7. # description: Sender Rewriting Scheme (SRS) for Postfix.
  8. # processname: @POSTSRSD@
  9. # pidfile: /var/run/@PROJECT_NAME@.pid
  10. # config: @CONFIG_DIR@/@PROJECT_NAME@
  11. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  12. DAEMON=@CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@
  13. NAME=@PROJECT_NAME@
  14. prog=@POSTSRSD@
  15. DESC="Postfix Sender Rewriting Scheme daemon"
  16. PIDFILE=/var/run/$NAME.pid
  17. SCRIPTNAME=@SYSCONF_DIR@/init.d/$NAME
  18. # Gracefully exit if the package has been removed.
  19. test -x $DAEMON || exit 0
  20. . @SYSCONF_DIR@/init.d/functions
  21. # Default configuration
  22. SRS_DOMAIN=`postconf -h mydomain || true`
  23. SRS_EXCLUDE_DOMAINS=
  24. # Read config file
  25. . @CONFIG_DIR@/$NAME
  26. test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 0
  27. do_start()
  28. {
  29. echo -n "Starting $DESC: "
  30. daemon $DAEMON -f "$SRS_FORWARD_PORT" -r "$SRS_REVERSE_PORT" -d "$SRS_DOMAIN" -s "$SRS_SECRET" \
  31. -u "$RUN_AS" -p "$PIDFILE" -a "$SRS_SEPARATOR" -c "$CHROOT" -D -X"$SRS_EXCLUDE_DOMAINS"
  32. RETVAL=$?
  33. echo
  34. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
  35. return $RETVAL
  36. }
  37. do_stop()
  38. {
  39. echo -n "Stopping $DESC: "
  40. killproc $prog
  41. RETVAL=$?
  42. echo
  43. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME
  44. return $RETVAL
  45. }
  46. case "$1" in
  47. start)
  48. do_start
  49. ;;
  50. stop)
  51. do_stop
  52. ;;
  53. status)
  54. status $NAME
  55. ;;
  56. restart|force-reload)
  57. do_stop
  58. do_start
  59. ;;
  60. reload)
  61. ;;
  62. condrestart|try-restart)
  63. if [ -f /var/lock/subsys/$NAME ]; then
  64. do_stop
  65. do_start
  66. fi
  67. ;;
  68. *)
  69. echo "Usage: $NAME {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
  70. [ "$1" = "usage" ] && exit 0
  71. exit 2
  72. ;;
  73. esac
  74. exit $?