a way to choose between postfwd and postfwd2

This commit is contained in:
Jan Wagner 2010-06-16 14:35:43 +00:00
parent dc1d9f7d40
commit 282172dd79
3 changed files with 29 additions and 6 deletions

View file

@ -58,4 +58,10 @@ In order to avoid the startup of the daemon on an unconfigured machine,
automatic startup, on boot, is disabled by default. To enable it just edit the automatic startup, on boot, is disabled by default. To enable it just edit the
file /etc/default/postfwd and set the "startup" variable to 1. file /etc/default/postfwd and set the "startup" variable to 1.
4. CHOOSING WHICH POSTFWD VERSION TO USE
----------------------------------------
Since some time, there is also a prefork version available, called postfwd2.
You can choose in /etc/default/postfwd to use 'postfwd' or postfwd2'.
-- Jan Wagner <waja@cyconet.org> Mon, 10 Mar 2008 22:37:44 +0100 -- Jan Wagner <waja@cyconet.org> Mon, 10 Mar 2008 22:37:44 +0100

View file

@ -3,6 +3,8 @@
# Set to '1' to enable startup (daemon mode) # Set to '1' to enable startup (daemon mode)
STARTUP=0 STARTUP=0
# using 'postfwd' or 'postfwd2'?
BINARY=postfwd
# Config file # Config file
CONF=/etc/postfix/postfwd.cf CONF=/etc/postfix/postfwd.cf
# IP where listen to # IP where listen to

27
debian/postfwd.init vendored
View file

@ -18,11 +18,6 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=postfwd NAME=postfwd
DAEMON=/usr/sbin/${NAME}
PIDFILE=/var/run/$NAME.pid
DESC=postfwd
test -x $DAEMON || exit 0
not_configured () { not_configured () {
echo "#### WARNING ####" echo "#### WARNING ####"
@ -39,6 +34,13 @@ no_configfile () {
exit 0 exit 0
} }
wrong_binary () {
echo "#### ERROR ####"
echo "${BINARY} is not a valid binary"
echo "###############"
exit 0
}
# check if postfwd is configured or not # check if postfwd is configured or not
if [ -f "/etc/default/$NAME" ] if [ -f "/etc/default/$NAME" ]
then then
@ -58,12 +60,25 @@ then
fi fi
# Check whether we have to drop privileges. # Check whether we have to drop privileges.
if [ -n "$RUNAS" ]; then if [ -n "$RUNAS" ]
then
if ! getent passwd "$RUNAS" >/dev/null; then if ! getent passwd "$RUNAS" >/dev/null; then
RUNAS="" RUNAS=""
fi fi
fi fi
if ! [ ${BINARY} == "postfwd" -o ${BINARY} == "postfwd2" ]
then
wrong_binary
fi
NAME=${BINARY}
DAEMON=/usr/sbin/${NAME}
PIDFILE=/var/run/$NAME.pid
DESC=postfwd
test -x $DAEMON || exit 0
set -e set -e
case "$1" in case "$1" in