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.init.in 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #! /bin/sh
  2. #
  3. # @PROJECT_NAME@
  4. # start/stop the @PROJECT_NAME@ daemon for Postfix
  5. #
  6. ### BEGIN INIT INFO
  7. # Provides: @PROJECT_NAME@
  8. # Required-Start: $syslog $network $local_fs
  9. # Required-Stop: $syslog $network $local_fs
  10. # Default-Start: 2 3 4 5
  11. # Default-Stop: 0 1 6
  12. # Short-Description: Start/stop the @PROJECT_NAME@ daemon
  13. ### END INIT INFO
  14. set -e
  15. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  16. DAEMON=@CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@
  17. NAME=@PROJECT_NAME@
  18. DESC="Postfix Sender Rewriting Scheme daemon"
  19. PIDFILE=/var/run/$NAME.pid
  20. SCRIPTNAME=/etc/init.d/$NAME
  21. # Gracefully exit if the package has been removed.
  22. test -x $DAEMON || exit 0
  23. . /lib/lsb/init-functions
  24. # Default configuration
  25. SRS_DOMAIN=`postconf -h mydomain || true`
  26. SRS_FORWARD_PORT=10001
  27. SRS_REVERSE_PORT=10002
  28. SRS_SECRET=/etc/@PROJECT_NAME@.secret
  29. RUN_AS=nobody
  30. CHROOT=@CHROOT_DIR@
  31. # Read config file if it is present.
  32. if [ -r /etc/default/$NAME ]
  33. then
  34. . /etc/default/$NAME
  35. fi
  36. POSTSRS_OPTS="-4 -f$SRS_FORWARD_PORT -r$SRS_REVERSE_PORT -d$SRS_DOMAIN -s$SRS_SECRET -u$RUN_AS -p$PIDFILE -c$CHROOT -D"
  37. test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 0
  38. ret=0
  39. case "$1" in
  40. start)
  41. log_daemon_msg "Starting $DESC" "$NAME"
  42. if start-stop-daemon --start --oknodo --quiet \
  43. --pidfile $PIDFILE \
  44. --name $NAME \
  45. --startas $DAEMON -- $POSTSRS_OPTS
  46. then
  47. log_end_msg 0
  48. else
  49. ret=$?
  50. log_end_msg 1
  51. fi
  52. ;;
  53. stop)
  54. log_daemon_msg "Stopping $DESC" "$NAME"
  55. if start-stop-daemon --stop --oknodo --quiet \
  56. --pidfile $PIDFILE --name $NAME
  57. then
  58. log_end_msg 0
  59. else
  60. ret=$?
  61. log_end_msg 1
  62. fi
  63. rm -f $PIDFILE
  64. ;;
  65. reload|force-reload|restart)
  66. $0 stop
  67. $0 start
  68. ret=$?
  69. ;;
  70. *)
  71. echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
  72. exit 1
  73. ;;
  74. esac
  75. exit $ret