Installation on SuSe 7.1

No Name Available johannes at DSP.DE
Wed Jan 22 09:52:45 GMT 2003


Hi, i´ve finalle rewritten the MailScanner init Script with Advice from
the .Tar installatio Guide and now it seems to work on my SuSE 7.1.
If anybody finds any Problem in the Script, i would be glad to get some
hints... I´am not shure about the "process ID Management" if its OK like
this...

Thanks for help, Greets Johannes

############################################################################
/etc/init.d/MailScanner
############################################################################
#!/bin/bash
#
# mailscanner   This shell script takes care of starting and stopping
#               MailScanner, and its associated copies of sendmail.
#
### BEGIN INIT INFO
# Provides:          MailScanner
# Required-Start:    $syslog $remote_fs
# X-UnitedLinux-Should-Start: $time $network $named ypbind
# Required-Stop:     $syslog $remote_fs
# X-UnitedLinux-Should-Stop: $time $network $named ypbind
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: MailScanner and sendmail daemons
# Description:       Start sendmail and MailScanner to provide
#       SMTP service with virus, dangerous contents and spam scanning.
### END INIT INFO

# Check for missing binaries (stale symlinks should not happen)
MAILSCANNER_BIN=/usr/sbin/check_MailScanner
test -x $MAILSCANNER_BIN   || exit 5
test -x /usr/sbin/sendmail || exit 5

test -s /etc/rc.config.d/sendmail.rc.config && \
      . /etc/rc.config.d/sendmail.rc.config

test -s /etc/sysconfig/MailScanner && \
      . /etc/sysconfig/MailScanner

if test -z "$MAILSCANNER_WORKDIR" ; then
    MAILSCANNER_WORKDIR="/var/spool/MailScanner/incoming"
fi
if test -z "$MAILSCANNER_INQDIR"  ; then
    MAILSCANNER_INQDIR="/var/spool/mqueue.in"
fi
if test -z "$SENDMAIL_IN_ARGS" ; then
    # JKF Need to add mqueue.in stuff here
    SENDMAIL_IN_ARGS="-bd -OPrivacyOptions=noetrn -ODeliveryMode=queueonly -
OQueueDirectory=/var/spool/mqueue.in"
fi
#if test -z "$SENDMAIL_CLIENT_ARGS" ; then
#    SENDMAIL_CLIENT_ARGS="-L sendmail-client -Ac -q30m"
#fi
if test -z "$SENDMAIL_OUT_ARGS" ; then
    SENDMAIL_OUT_ARGS="-q5m -om"
fi
if test "$SMTPD_LISTEN_REMOTE" != "yes" ; then
    SENDMAIL_IN_ARGS="-O DaemonPortOptions=Addr=127.0.0.1 $SENDMAIL_IN_ARGS"
fi
SENDMAIL_IN_ARGS="-O DaemonPortOptions=Addr=0.0.0.0 $SENDMAIL_IN_ARGS"

srvpid=/var/run/sendmail.pid
srvoutpid=/var/run/sendmail-out.pid
mspid=/var/run/MailScanner.pid

. /etc/rc.status
rc_reset
case "$1" in
    startin)
    echo -n "Initializing incoming sendmail"
        startproc    -p $srvpid /usr/sbin/sendmail $SENDMAIL_IN_ARGS
        rc_status
        ;;
    startout)
    echo -n "Initializing outgoing sendmail"
        startproc  -p $srvoutpid /usr/sbin/sendmail $SENDMAIL_OUT_ARGS
        rc_status
    ;;
    start)
        echo -n "Initializing sendmail and MailScanner"
        startproc    -p $srvpid /usr/sbin/sendmail $SENDMAIL_IN_ARGS
        rc_status
        startproc -f -p $srvoutpid /usr/sbin/sendmail $SENDMAIL_OUT_ARGS
        rc_status
    startproc -f -p $mspid /usr/sbin/check_MailScanner >/dev/null
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down sendmail and MailScanner"
        killproc -p $srvpid -TERM /usr/sbin/sendmail
    rc_status

    echo -n "Shutting down SMTP port:"
        killproc -TERM /usr/sbin/sendmail || return=$rc_failed
        rc_status

#       killproc -p $srvoutpid -TERM /usr/sbin/sendmail
#    rc_status
    killproc -p $mspid -TERM /usr/sbin/MailScanner
        rc_status -v
        # Clear out all the old pid files
        rm -f $mspid
        # Clear out the old incoming dirs
        cd $MAILSCANNER_WORKDIR && ls | xargs /bin/rm -rf
        ;;
    try-restart)
        $0 stop && sleep 5 && $0 start
        rc_status
        ;;
    restart)
        $0 stop
    sleep 5
        $0 start
        rc_status
        ;;
    reload|force-reload)
        echo -n "Reload service sendmail"
        killproc -p $mspid -HUP /usr/sbin/MailScanner
        rc_status -v
        ;;
    status)
        echo -n "Checking for service sendmail: "
        checkproc -p $srvpid /usr/sbin/sendmail
        rc_status
    checkproc -p $srvoutpid /usr/sbin/sendmail
    rc_status
    checkproc -p $mspid /usr/sbin/MailScanner
        rc_status -v
        ;;
    probe)
        test /etc/sendmail.cf -nt $srvpid -o /etc/mail/submit.cf -nt
$msppid \
        -o /etc/MailScanner/MailScanner.conf -nt $mspid && echo reload
        ;;
    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-
reload|reload|probe|startin|startout}"
        exit 1
esac
rc_exit

############################################################################

############################################################################
/etc/MailScanner/MailScanner.conf
############################################################################
#
# with what parameters should the incoming sendmail be started?
# this is used to provide SMTP service and queue mail into
# /var/spool/mqueue.in, ready for scanning by MailScanner.
# normal sites use "-bd -om".
#
SENDMAIL_IN_ARGS="-bd -OPrivacyOptions=noetrn -ODeliveryMode=queueonly -
OQueueDirectory=/var/spool/mqueue.in"

#
# with what parameters should the outgoing sendmail be started?
# this is used to deliver mail that has been scanned by MailScanner.
# normal sites use "-q30m -om".
#
SENDMAIL_OUT_ARGS="-q5m -om"

#
# where does MailScanner unpack messages for scanning?
# normal sites use "/var/spool/MailScanner/incoming".
#
MAILSCANNER_WORKDIR=/var/spool/MailScanner/incoming

#
# where does the incoming sendmail deposit messages, so that
# MailScanner can collect and scan them?
# normal sites use "/var/spool/mqueue.in".
#
MAILSCANNER_INQDIR=/var/spool/mqueue.in

############################################################################



More information about the MailScanner mailing list