Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

postsrsd.rh_init.in 1.8KB

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