[Fwd: Ensim WEBppliance 3.1.1 / Redhat 7.2 & MailScanner 4.02-3]

Andrew G Allen mail at projectandrew.com
Sat Oct 26 23:36:15 IST 2002


I guess it would help if I actually attached the files...

Andrew G Allen
email: mail at projectandrew.com | voice: +44 (0) 7958 540596

--- Disclaimer ---
This e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this email in error, please notify the
system manager.

-------- Original Message --------
Subject: Ensim WEBppliance 3.1.1 / Redhat 7.2 & MailScanner 4.02-3
From: Andrew G Allen <mail at PROJECTANDREW.COM>
Date: Sat, October 26, 2002 23:32
To: MAILSCANNER at JISCMAIL.AC.UK

I am ironing out all the remaining niggles with the MailScanner
installation on my system which itself is working perfectly. One feature
of Ensim WEBppliance is to record bandwidth used on sendmail etc for
each virtual site on the system. Part of this means there was some
custom config in the original sendmail start up script (attached).

I wondered if any experts here could just peruse the two startup scripts
to see what I need to add to the MailScanner startup script to correctly
include the customizations in the sendmail script, without messing up
how MailScanner works?

I am experimenting myself at the moment, but I thought I'd post this
here just in case someone else has already succeded in doing this.

Thanks!

Andrew G Allen
email: mail at projectandrew.com | voice: +44 (0) 7958 540596

--- Disclaimer ---
This e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this email in error, please notify the
system manager.





--
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.



--
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.

-------------- next part --------------
#!/bin/bash
#
# sendmail      This shell script takes care of starting and stopping
#               sendmail.
#
# chkconfig: 2345 80 30
# description: Sendmail is a Mail Transport Agent, which is the program \
#              that moves mail from one machine to another.
# processname: sendmail
# config: /etc/sendmail.cf
# pidfile: /var/run/sendmail.pid

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source sendmail configureation.
if [ -f /etc/sysconfig/sendmail ] ; then
        . /etc/sysconfig/sendmail
else
        DAEMON=no
        QUEUE=1h
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/sendmail ] || exit 0

RETVAL=0
prog="sendmail"

start() {
        # Start daemons.

        echo -n $"Starting $prog: "
        /usr/bin/newaliases > /dev/null 2>&1
        for i in virtusertable access domaintable ; do
            if [ -f /etc/mail/$i ] ; then
                makemap hash /etc/mail/$i < /etc/mail/$i
            fi
        done
        mailertables=
        if [ -f /etc/mail/mailertable.virtual_domains ]; then
            mailertables="/etc/mail/mailertable.virtual_domains"
        fi
        if [ -f /etc/mail/mailertable ]; then
            mailertables="$mailertables /etc/mail/mailertable"
        fi
        if [ -n "$mailertables" ]; then
            cat $mailertables | makemap hash /etc/mail/mailertable.db
        fi
        genericstables=
        if [ -f /etc/mail/genericstable.siteadmins ]; then
            genericstables="/etc/mail/genericstable.siteadmins"
        fi
        if [ -f /etc/mail/genericstable ]; then
            genericstables="$mailertables /etc/mail/genericstable"
        fi
        if [ -n "$genericstables" ]; then
            cat $genericstables | makemap hash /etc/mail/genericstable.db
        fi
        export LD_PRELOAD=/lib/libensimvwhbw.so
        export ENSIMVWH_BWSVCID=1
        daemon /usr/sbin/sendmail $([ "$DAEMON" = yes ] && echo -bd) \
                                  $([ -n "$QUEUE" ] && echo -q$QUEUE)
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
        return $RETVAL
}

start-fast() {
        # Start daemons.

        echo -n $"Starting $prog: "
        /usr/bin/newaliases > /dev/null 2>&1
        for i in virtusertable access domaintable ; do
            if [ -f /etc/mail/$i ] ; then
                makemap hash /etc/mail/$i < /etc/mail/$i
            fi
        done
        export LD_PRELOAD=/lib/libensimvwhbw.so
        export ENSIMVWH_BWSVCID=1
        daemon /usr/sbin/sendmail $([ "$DAEMON" = yes ] && echo -bd) \
                                  $([ -n "$QUEUE" ] && echo -q$QUEUE)
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
        return $RETVAL
}

stop() {
        # Stop daemons.
        echo -n $"Shutting down $prog: "
        killproc sendmail
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  start-fast)
        start-fast
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/sendmail ]; then
            stop
            start
            RETVAL=$?
        fi
        ;;
  status)
        status sendmail
        RETVAL=$?
        ;;
  restart-fast)
        stop
        start-fast
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status|start-fast|restart-fast}"
        exit 1
esac

exit $RETVAL

-------------- next part --------------
#!/bin/sh
#
# mailscanner   This shell script takes care of starting and stopping
#               MailScanner, and its associated copies of sendmail.
#
# chkconfig: 2345 80 30
# description: MailScanner is an open-source E-Mail Gateway Virus Scanner.
# processname: MailScanner
# config: /etc/MailScanner/MailScanner.conf
# pidfile: /var/run/MailScanner/MailScanner.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source mailscanner configureation.
if [ -f /etc/sysconfig/MailScanner ] ; then
        . /etc/sysconfig/MailScanner
else
        QUEUETIME=15m
        PIDDIR=/var/run/MailScanner
        export QUEUETIME
        export PIDDIR
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/check_MailScanner ] || exit 0
[ -f /usr/sbin/sendmail ] || exit 0

# Get a string of all the PIDs of MailScanner
#MailScannerPids() {
#       cd $PIDDIR || return 1
#       PIDLIST=`ls | grep '^MailScanner.' | sed -e 's/MailScanner.//g'`
#       echo PIDLIST
#       return 0
#}

# Start both the sendmail processes
StartInSendmail() {
        /usr/bin/newaliases > /dev/null 2>&1
        if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
            make -C /etc/mail -q
        else
            for i in virtusertable access domaintable mailertable ; do
                if [ -f /etc/mail/$i ] ; then
                    makemap hash /etc/mail/$i < /etc/mail/$i
                fi
            done
        fi
        /usr/sbin/sendmail -bd -ODeliveryMode=queueonly \
                           -OQueueDirectory=/var/spool/mqueue.in
        success
        echo
}
StartOutSendmail() {
        /usr/sbin/sendmail $([ -n "$QUEUETIME" ] && echo -q$QUEUETIME)
        success
        echo
}

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo 'Starting MailScanner daemons:'
        echo -n '         incoming sendmail: '
        StartInSendmail
        echo -n '         outgoing sendmail: '
        StartOutSendmail
        echo -n '         MailScanner:       '
        /usr/sbin/check_MailScanner >/dev/null
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScanner
        success
        echo
        ;;
  stop)
        # Stop daemons.
        echo    'Shutting down MailScanner daemons:'
        echo -n '         MailScanner:       '
        killproc MailScanner
        echo
        echo -n '         incoming sendmail: '
        killproc sendmail 2>/dev/null
        echo
        echo -n '         outgoing sendmail: '
        killproc /usr/sbin/sendmail 2>/dev/null
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScanner
        # Clear out all the old pid files
        #[ -f /var/run/MailScanner/MailScanner.* ] && \
        rm -f /var/run/MailScanner/MailScanner.*
        ;;
  status)
        # Work out if all of MailScanner is running
        echo    'Checking MailScanner daemons:'
        echo -n '         MailScanner:       '
        pid=`pidofproc MailScanner`
        if [ -z "$pid" ] ; then failure; else success; fi
        echo
        # Now the incoming sendmail
        echo -n '         incoming sendmail: '
        pid=`ps ax | grep 'sendmai[l]: accepting connections'`
        if [ -z "$pid" ] ; then failure; else success; fi
        echo
        # Now the outgoing sendmail
        echo -n '         outgoing sendmail: '
        # More complex regexp to handle other RedHats
        pid=`ps ax | egrep '\[sendmail\]|sendmai[l] -q[0-9]*[mhd]'`
        if [ -z "$pid" ] ; then failure; else success; fi
        echo
        ;;
  restart)
        $0 stop
        sleep 2
        $0 start
        RETVAL=$?
        ;;
  reload)
        echo -n 'Reloading MailScanner:      '
        pid=`pidofproc MailScanner`
        if [ -z "$pid" ] ; then failure; echo
        else success; echo; kill -HUP $pid; fi
        ;;
  *)
        echo "Usage: service MailScanner {start|stop|status|restart|reload}"
        exit 1
esac

exit $RETVAL




More information about the MailScanner mailing list