Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

postsrsd.sysv-redhat.in 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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" \
  31. -s "$SRS_SECRET" -n "$SRS_HASHLENGTH" -N "$SRS_HASHMIN" \
  32. -u "$RUN_AS" -p "$PIDFILE" -a "$SRS_SEPARATOR" -c "$CHROOT" -D -X"$SRS_EXCLUDE_DOMAINS"
  33. RETVAL=$?
  34. echo
  35. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
  36. return $RETVAL
  37. }
  38. do_stop()
  39. {
  40. echo -n "Stopping $DESC: "
  41. killproc $prog
  42. RETVAL=$?
  43. echo
  44. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME
  45. return $RETVAL
  46. }
  47. case "$1" in
  48. start)
  49. do_start
  50. ;;
  51. stop)
  52. do_stop
  53. ;;
  54. status)
  55. status $NAME
  56. ;;
  57. restart|force-reload)
  58. do_stop
  59. do_start
  60. ;;
  61. reload)
  62. ;;
  63. condrestart|try-restart)
  64. if [ -f /var/lock/subsys/$NAME ]; then
  65. do_stop
  66. do_start
  67. fi
  68. ;;
  69. *)
  70. echo "Usage: $NAME {start|stop|restart|condrestart|try-restart|reload|force-reload|status|usage}"
  71. [ "$1" = "usage" ] && exit 0
  72. exit 2
  73. ;;
  74. esac
  75. exit $?