Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

postsrsd.init.in 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 0
  37. ret=0
  38. case "$1" in
  39. start)
  40. log_daemon_msg "Starting $DESC" "$NAME"
  41. if start-stop-daemon --start --oknodo --quiet \
  42. --pidfile $PIDFILE \
  43. --name $NAME \
  44. --startas $DAEMON \
  45. -- -4 -f"$SRS_FORWARD_PORT" -r"$SRS_REVERSE_PORT" -d"$SRS_DOMAIN" -s"$SRS_SECRET" -u"$RUN_AS" -p"$PIDFILE" -c"$CHROOT" -X"$SRS_EXCLUDE_DOMAINS" -D
  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