MailScanner Postfix and SuSE 8.1
Samuel Luxford-Watts
slwatts at WINCKWORTHS.CO.UK
Tue Jul 1 18:18:38 IST 2003
Ok - I kinda got a script that works ok. I am fumbling round in the dark a
little as this is beyond my basic scripting abilities. Start startin
startout, stop stopin stopout and status all work. The problem is if you do
a start, then say a stopin and then status it returns the wrong status - all
are up when they are clearly not.
I hope you can get your fan fixed soon!!!
Anyway - hope its of use as a starting point......
Sam
Begin /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/MailScanner
#srvpid=/var/run/postfix-in.pid
#srvoutpid=/var/run/postfix-out.pid
mspid=/var/run/MailScanner.pid
srvinpid=/var/spool/postfix.in/pid/master.pid
srvoutpid=/var/spool/postfix/pid/master.pid
POSTFIX_BIN=/usr/sbin/postfix
POSTFIX_IN=/etc/postfix.in
POSTFIX_OUT=/etc/postfix
MASTER_BIN=/usr/lib/postfix/master
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
test -x $POSTFIX_BIN || exit 5
test -x $MASTER_BIN || exit 5
. /etc/rc.status
rc_reset
case "$1" in
startin)
rc_reset
echo -n "Initialising incoming mail process (postfix):"
$POSTFIX_BIN -c $POSTFIX_IN start > /dev/null 2>&1
# Remember status and be verbose
rc_status -v
( i=60
# waiting for qmgr
while [ -z "$(pidof qmgr)" -a $i -gt 0 ]; do
i=$(( $i - 1 ))
sleep 1
done
$POSTFIX_BIN -c $POSTFIX_IN flush ) > /dev/null 2>&1 &
;;
startout)
rc_reset
echo -n "Initialising outgoing mail process (postfix):"
$POSTFIX_BIN -c $POSTFIX_OUT start > /dev/null 2>&1
# Remember status and be verbose
rc_status -v
( i=60
# waiting for qmgr
while [ -z "$(pidof qmgr)" -a $i -gt 0 ]; do
i=$(( $i - 1 ))
sleep 1
done
$POSTFIX_BIN -c $POSTFIX_IN flush ) > /dev/null 2>&1 &
;;
start)
$0 startin
sleep 5
$0 startout
rc_reset
echo -n "Starting MailScanner:"
/usr/sbin/check_MailScanner >/dev/null
rc_status -v
rm -f /var/lock/subsys/MailScanner.off >/dev/null 2>&1
;;
stopin)
rc_reset
echo -n "Shutting down Incoming Mail Process (postfix):"
/sbin/killproc -p $srvinpid -TERM $MASTER_BIN
rc_status -v
;;
stopout)
rc_reset
echo -n "Shutting down Incoming Mail Process (postfix):"
/sbin/killproc -p $srvoutpid -TERM $MASTER_BIN
rc_status -v
;;
stop)
$0 stopin
sleep 5
$0 stopout
rc_reset
echo -n "Shutting down MailScanner:"
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 | egrep '^[0123456789]+$' | xargs
/bin/rm -rf 2>/dev/null
touch /var/lock/subsys/MailScanner.off >/dev/null 2>&1
;;
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 incoming Mail process (procmail): "
checkproc -p $srvinpid $MASTER_BIN
rc_status -v
rc_reset
echo -n "Checking for outgoing Mail process (procmail): "
checkproc -p $srvoutpid $MASTER_BIN
rc_status -v
rc_reset
echo -n "Checking for MailScanner: "
checkproc -p $mspid $MAILSCANNER_BIN
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|sta
rtout}
"
exit 1
esac
rc_exit
---------------------------
End
-----Original Message-----
From: Julian Field [mailto:mailscanner at ECS.SOTON.AC.UK]
Sent: 01 July 2003 14:23
To: MAILSCANNER at JISCMAIL.AC.UK
Subject: Re: MailScanner Postfix and SuSE 8.1
I need to do some more work on the SuSE init.d script so it is as clever as
my RedHat one.
In the mean time, look in the init.d script for code that starts with a line
saying "startin)" and replace the following 3 sections with this:
startin)
echo -n "Initializing incoming Postfix"
startproc -p $srvpid postfix -c /etc/postfix.in
rc_status
;;
startout)
echo -n "Initializing outgoing Postfix"
startproc -f -p $srvoutpid postfix -c /etc/postfix
rc_status
;;
start)
echo -n "Initializing Postfix and MailScanner"
startproc -p $srvpid postfix -c /etc/postfix.in
rc_status
startproc -f -p $srvoutpid postfix -c /etc/postfix
rc_status
startproc -f -p $mspid /usr/sbin/check_MailScanner >/dev/null
rc_status -v
rm -f /var/lock/subsys/MailScanner.off >/dev/null 2>&1
;;
At 13:17 01/07/2003, you wrote:
>Hi,
>
>Can someone help me please?!
>
>I have just installed a clean copy of SuSE 8.1, Postfix (1.1.11-110),
>Sophos, and MailScanner. I used the latest stable release from the
>Mailscanner website (Version 4.21-9 for SuSE Linux 8.0/8.1).
>
>I ran the installation script and followed through every step in the
>Using MailScanner with Postfix installation guide with no real problems
>except one
>- the guide refers to a utility called redhat-switchmail-nox which I do not
>have. Anyway When I try to run /etc/init.d/MailScanner start I get the
>following errors:
>Initializing sendmail and MailScannersendmail: invalid option -- O
>sendmail: fatal: usage: sendmail [options]
>sendmail: invalid option -- A
>sendmail: fatal: usage: sendmail [options]
>sendmail: invalid option -- A
>sendmail: fatal: usage: sendmail [options]
>
failed
>I have had a look through the init.d script and it looks nothing like the
>updated one on the Mailscanner website. Also /etc/sysconfig/MailScanner has
>no MTA= line in it and I have not added one. It only has a number of
>SENDMAIL_*_ARGS options and the workdir directives. Is this right? Or do I
>need to add the MTA Line anyway? It doesn't seem to be used by the
>init.d/MailScanner script that was installed with the SuSE package.
>
>Has anyone got any ideas on how I can get this working? I guess I just
>need to tweak the sendmail options but do not know which ones should be
>used.
>
>Thanks in advance,
>
>Sam
>
>-----Original Message-----
>From: L-Soft list server at JISCMAIL (1.8e)
>[mailto:LISTSERV at JISCMAIL.AC.UK]
>
>Sent: 01 July 2003 13:00
>To: Sam Luxford-Watts
>Subject: Welcome to MailScanner
>
>
>This list is for the discussion of the MailScanner e-mail virus and
>spam protector. It is also used for announcements of new releases.
>
>If you *only* want announcements of new releases, then you would do
>better to subscribe to the MailScanner project at
>http://www.freshmeat.net/projects/mailscanner.
>
>--
>Jules
>www.mailscanner.info
--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support
More information about the MailScanner
mailing list