選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

postsrsd.sysv-lsb.in 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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=@SYSCONF_DIR@/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_EXCLUDE_DOMAINS=
  27. # Read config file
  28. . @CONFIG_DIR@/$NAME
  29. test -r "$SRS_SECRET" -a -n "$SRS_DOMAIN" || exit 0
  30. ret=0
  31. case "$1" in
  32. start)
  33. log_daemon_msg "Starting $DESC" "$NAME"
  34. if start-stop-daemon --start --oknodo --quiet \
  35. --pidfile $PIDFILE \
  36. --name $NAME \
  37. --startas $DAEMON \
  38. -- -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
  39. then
  40. log_end_msg 0
  41. else
  42. ret=$?
  43. log_end_msg 1
  44. fi
  45. ;;
  46. stop)
  47. log_daemon_msg "Stopping $DESC" "$NAME"
  48. if start-stop-daemon --stop --oknodo --quiet \
  49. --pidfile $PIDFILE --name $NAME
  50. then
  51. log_end_msg 0
  52. else
  53. ret=$?
  54. log_end_msg 1
  55. fi
  56. rm -f $PIDFILE
  57. ;;
  58. reload|force-reload|restart)
  59. $0 stop
  60. $0 start
  61. ret=$?
  62. ;;
  63. status)
  64. log_daemon_msg "postsrsd is running"
  65. if [ -s $PIDFILE ]; then
  66. PID=`cat $PIDFILE`
  67. if kill -0 "$PID" 2>/dev/null; then
  68. log_end_msg 0
  69. else
  70. log_end_msg 1
  71. fi
  72. else
  73. log_end_msg 1
  74. fi
  75. ;;
  76. *)
  77. echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
  78. exit 1
  79. ;;
  80. esac
  81. exit $ret