A couple of questions

paul at VANBROUWERSHAVEN.COM paul at VANBROUWERSHAVEN.COM
Thu Sep 5 13:04:46 IST 2002


I use the following script it works ok:


#!/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: /usr/local/MailScanner/etc/mailscanner.conf
# pidfile: /usr/local/MailScanner/var/virus.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
fi

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

[ -f /usr/local/MailScanner/bin/check_mailscanner ] || exit 0
[ -f /usr/sbin/sendmail ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo 'Starting MailScanner daemons:'
        /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
        echo -n '         incoming sendmail: '
        /usr/sbin/sendmail -bd -ODeliveryMode=queueonly \
                           -OQueueDirectory=/var/spool/mqueue.in
        success
        echo
        echo -n '         outgoing sendmail: '
        /usr/sbin/sendmail $([ -n "$QUEUETIME" ] && echo -q$QUEUETIME)
        success
        echo
        echo -n '         MailScanner:       '
        /usr/local/MailScanner/bin/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
        ;;
  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|reload)
        $0 stop
        sleep 2
        $0 start
        RETVAL=$?
        ;;
  *)
        echo "Usage: mailscanner {start|stop|status|restart}"
        exit 1
esac



Paul van Brouwershaven

> -----Original Message-----
> From: MailScanner mailing list
> [mailto:MAILSCANNER at JISCMAIL.AC.UK] On Behalf Of Mike Kercher
> Sent: Thursday, September 05, 2002 1:54 PM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: A couple of questions
>
>
> One of the machines I have MS installed on is a RAQ too and I also had
> the problem of the init script not killing the mailscanner process.  I
> had to modify the init script to kill 'perl' instead of 'mailscanner'.
> Luckily, I don't have any other perl processes running on
> that box :)  I
> know it's not a clean fix, but it works.  Below is the stop
> section from
> my init script.
>
> stop)
>         # Stop daemons.
>         echo    'Shutting down MailScanner daemons:'
>         echo -n '              MailScanner:       '
>         killproc perl
>         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
>         ;;
>
> Mike
>
>
> -----Original Message-----
> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK] On
> Behalf Of craig
> Sent: Thursday, September 05, 2002 4:39 AM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: A couple of questions
>
>
> > >When does it use the
> > >Deleted Virus Message Report
> > >and
> > >Deleted Bad Filename reports ?
> > >when virus scanning ?
> >
> > If an attachment fails the filename checking, and the attachment is
> > not being saved to disk (i.e. "Action = delete", then the
> badly-named
> > attachment will be replaced by the "Delete Bad Filename Report".
>
> Thnaks for that I found the problem I m using this on cobalt raq and
> seems that the init script does not kill mailscanner when you
> do a stop
> or restart it does that to sendmail process so this is why when I did
> the chnages to mailscanner.conf they did not show up
>
> I will check out that init script and find out why and let Mr
> Bassi know
> if its a bug
>



More information about the MailScanner mailing list