rbraym
asked on
MailScanner duplicating messages
Hi Experts.
I have a server with redhat linux 9.0 and MailScanner+spamassassin+s endmail. I noticed that some mails (about a week ago) are arriving duplicated. I checked the mail log and this is what it shows (a lot of messages like this):
Nov 19 11:25:17 master MailScanner[7422]: Failed to link message body between queues (/var/spool/mqueue/dfiAJGP CS7017073 --> /var/spool/mqueue.in/dfiAJ GPCS701707 3)
Can somebody tell me what's wrong with MailScanner and how to fix this problem??
Thanks a lot.
RBrayM
I have a server with redhat linux 9.0 and MailScanner+spamassassin+s
Nov 19 11:25:17 master MailScanner[7422]: Failed to link message body between queues (/var/spool/mqueue/dfiAJGP
Can somebody tell me what's wrong with MailScanner and how to fix this problem??
Thanks a lot.
RBrayM
ASKER
Hello jlevie..
I'm using MailScanner MailScanner version 4.34.8 under Red Hat Enterprise Linux ES release 3.
'df -k /var/spool' returns:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda10 10072456 3263564 6297224 35% /var
'df -i /var/spool' returns:
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda10 1281696 109049 1172647 9% /var
I guess it's ok.. what can you say??
I'm using MailScanner MailScanner version 4.34.8 under Red Hat Enterprise Linux ES release 3.
'df -k /var/spool' returns:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda10 10072456 3263564 6297224 35% /var
'df -i /var/spool' returns:
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda10 1281696 109049 1172647 9% /var
I guess it's ok.. what can you say??
Yep, it isn't a disk resource problem.
In terms of MailScanner versions you are a good bit behind the curve (current stable version is 4.35.11-1). The first thing I'd do towards solving this is to upgrade to the current version. I'd also make sure that your RHEL system is fully up to date (as in running up2date). Note that the kernel is excluded by default and that restriction needs to be removed so that it gets updated also.
In terms of MailScanner versions you are a good bit behind the curve (current stable version is 4.35.11-1). The first thing I'd do towards solving this is to upgrade to the current version. I'd also make sure that your RHEL system is fully up to date (as in running up2date). Note that the kernel is excluded by default and that restriction needs to be removed so that it gets updated also.
ASKER
Well, i have upgraded MailScanner to MailScanner version 4.35.11 but the problem is showing up:
Nov 20 09:04:38 master MailScanner[7822]: Failed to link message body between queues (/var/spool/mqueue/dfiAKE4 YPr008088 --> /var/spool/mqueue.in/dfiAK E4YPr00808 8)
And that mail was received 2 times.. Any other suggestion??
Thanx.
Nov 20 09:04:38 master MailScanner[7822]: Failed to link message body between queues (/var/spool/mqueue/dfiAKE4
And that mail was received 2 times.. Any other suggestion??
Thanx.
What does 'find /var/spool/mqueue -type f | wc -l' show?
ASKER
It shows the number "6".
The reason I asked for that information was to see if there might have been a humongous number of files in mqueue, which isn't the case. Could you mail a copy of your mailscanner.conf to jlevie@experts-exchange.co m (mentioning this question in the Subject). It is really too long to post in a comment and I need to see how you have MailScanner configured.
ASKER
ok.. i sent it..
i'll Wait for your comments.
Thanks.
i'll Wait for your comments.
Thanks.
Got it, comments to follow shortly.
Your config looks fine and I don't see anything in it that could cause this. One possible cause would be if you had to master copies of MailScanner running. Could that be the case?
To fix that you'd want to shutdown mailscanner and check the process list (ps -ef) to make sure that all had exited before starting it back up.
To fix that you'd want to shutdown mailscanner and check the process list (ps -ef) to make sure that all had exited before starting it back up.
ASKER
Wel, i stoped MailScanner ( service MailScanner stop) and ps -ef doesn't show any other MailScanner process, however it still show a sendmail process:
root 16233 1 0 15:00 ? 00:00:00 sendmail: iAKK0ik4016233 [200.123.224.10]: DATA
And i did Service sendmail status, and it shows running. It must be stoped, right??..
Maybe there's a problem with sendmail. Where can i get the latest sendmail RPM???
RBrayM
root 16233 1 0 15:00 ? 00:00:00 sendmail: iAKK0ik4016233 [200.123.224.10]: DATA
And i did Service sendmail status, and it shows running. It must be stoped, right??..
Maybe there's a problem with sendmail. Where can i get the latest sendmail RPM???
RBrayM
It isn't a sendmail problem. The log clearly states that this is something that MailScanner is doing.
MailScanner and Sendmail are somewhat independent. You can stop/start either without having to mess with the other. The default installation of MailScanner will combine the startup/shutdown of MailScanner and Sendmail into one init script and remove RedHat's sendmail init script. Updating the sendmail package will re-install the sendmail init script and cause problems with mail not being scanned by MailScanner, but I don't think it should cause this.
Also a stop of MailScanner & Sendmail only kill the master process. The children of the master sendmail and mailscanner will continue to run until they've finished their processing. The sendmail process you show abow is one of those children. This behavior could cause duplicates is Sendmail/MailScanner is being restarted frequently, could that be happening here?
Restart MailScanner and lets see if the problem continues.
MailScanner and Sendmail are somewhat independent. You can stop/start either without having to mess with the other. The default installation of MailScanner will combine the startup/shutdown of MailScanner and Sendmail into one init script and remove RedHat's sendmail init script. Updating the sendmail package will re-install the sendmail init script and cause problems with mail not being scanned by MailScanner, but I don't think it should cause this.
Also a stop of MailScanner & Sendmail only kill the master process. The children of the master sendmail and mailscanner will continue to run until they've finished their processing. The sendmail process you show abow is one of those children. This behavior could cause duplicates is Sendmail/MailScanner is being restarted frequently, could that be happening here?
Restart MailScanner and lets see if the problem continues.
ASKER
Ok.. Let's Wait to see if the problem continues..
hi rbraym ,
The problem is not relaed to either your disc size nor with version or configuration !
I think its the Mailbox Size setting ! Default Mailbox size is approx 50MB , You need to edit your sendmail default settings for mailbox_size to 0 i.e Infinity !
Actully i also configured my mail proxy server and has got the same problem ! But I am using Postfix Configuration with Amavis and Clamav antivirus for virus scanning ! I solved the problem by just adding parameter for mailbox_size=0 in main.cf of postfix this zero will take infinity value ! And now Relaxed from mailboxsize problem !
You can try finding out thease settings in sendmail.cf and change accordingly !
Hope this will solve your problem !
The problem is not relaed to either your disc size nor with version or configuration !
I think its the Mailbox Size setting ! Default Mailbox size is approx 50MB , You need to edit your sendmail default settings for mailbox_size to 0 i.e Infinity !
Actully i also configured my mail proxy server and has got the same problem ! But I am using Postfix Configuration with Amavis and Clamav antivirus for virus scanning ! I solved the problem by just adding parameter for mailbox_size=0 in main.cf of postfix this zero will take infinity value ! And now Relaxed from mailboxsize problem !
You can try finding out thease settings in sendmail.cf and change accordingly !
Hope this will solve your problem !
Sendmail defaults to an unlimited message size, mailbox size, and number of recipients. And even if limits were imposed in sendmail it is MailScanner that's having the problem, not Sendmail.
ASKER
Well jlevie, maybe there's something wrong with sendmail.
I try to exec /usr/lib/sendmail -v -q -C/etc/mail/sendmail.cf, and i get this error msg:
Usage: /usr/lib/sendmail {start|stop|restart|condre start|stat us}
It seems like sendmail isn't runnig but it is.
What could it be??
I try to exec /usr/lib/sendmail -v -q -C/etc/mail/sendmail.cf, and i get this error msg:
Usage: /usr/lib/sendmail {start|stop|restart|condre
It seems like sendmail isn't runnig but it is.
What could it be??
The sendmail binary lives in /usr/sbin on a RedHat system. The "sendmail" in /usr/lib is a symlink to /etc/alternatives/mta-send mail.
Try '/usr/sbin/sendmail -v -q -C/etc/mail/sendmail.cf'
Try '/usr/sbin/sendmail -v -q -C/etc/mail/sendmail.cf'
ASKER
ok.. it worked, but i still getting the same error... i searched all my logs and i find this:
Nov 22 16:41:39 master MailScanner[25938]: Failed to link message body between queues (/var/spool/mqueue/dfiAMLf XQ9031887 --> /var/spool/mqueue.in/dfiAM LfXQ903188 7)
Nov 22 16:41:39 master sendmail[31914]: iAMLfXQ9031887: SYSERR(root): readqf: cannot open ./dfiAMLfXQ9031887: No such file or directory
What is happening??
Nov 22 16:41:39 master MailScanner[25938]: Failed to link message body between queues (/var/spool/mqueue/dfiAMLf
Nov 22 16:41:39 master sendmail[31914]: iAMLfXQ9031887: SYSERR(root): readqf: cannot open ./dfiAMLfXQ9031887: No such file or directory
What is happening??
What does 'ls /etc/init.d' show?
What does 'cat /etc/init.d/sendmail' show?
What does 'cat /etc/init.d/sendmail' show?
ASKER
1. ls /etc/init.d shows:
aep1000 dc_client functions irqbalance megadev nfslock raidmon smb vsftpd
apmd dc_server gpm isdn microcode_ctl nscd random snmpd webmin
arptables_jf dellomsa halt kdcrotate mysql ntpd rawdevices snmptrapd winbind
atd dellomsaesm hpoj killall named omawsd rhnsd spamassassin xfs
autofs dhcpd httpd kudzu netdump pcmcia saslauthd squid xinetd
bcm5820 dhcrelay httpd.lock lisa netdump-server portmap sendmail sshd ypbind
canna dkms_autoinstaller ip6tables MailScanner netfs postfix sendmail-copy syslog yppasswdd
crond firstboot iptables mdmonitor network proftpd single tux ypserv
cups FreeWnn irda mdmpd nfs psacct smartd vncserver ypxfrd
2. cat /etc/init.d/sendmail shows:
#!/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/mail/sendmail.cf
# pidfile: /var/run/sendmail.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Source sendmail configureation.
if [ -f /etc/sysconfig/sendmail ] ; then
. /etc/sysconfig/sendmail
else
DAEMON=no
QUEUE=1h
fi
[ -z "$SMQUEUE" ] && SMQUEUE="$QUEUE"
[ -z "$SMQUEUE" ] && SMQUEUE=1h
# 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: "
if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
make all -C /etc/mail -s
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/bin/newaliases > /dev/null 2>&1
daemon /usr/sbin/sendmail $([ "x$DAEMON" = xyes ] && echo -bd) \
$([ -n "$QUEUE" ] && echo -q$QUEUE) $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
if ! test -f /var/run/sm-client.pid ; then
echo -n $"Starting sm-client: "
touch /var/run/sm-client.pid
chown smmsp:smmsp /var/run/sm-client.pid
daemon --check sm-client /usr/sbin/sendmail -L sm-msp-queue -Ac \
-q $SMQUEUE $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sm-client
fi
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc sendmail
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
if test -f /var/run/sm-client.pid ; then
echo -n $"Shutting down sm-client: "
killproc sm-client
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/run/sm-client.pid
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sm-client
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/sendmail ]; then
stop
start
RETVAL=$?
fi
;;
status)
status sendmail
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condre start|stat us}"
exit 1
esac
exit $RETVAL
aep1000 dc_client functions irqbalance megadev nfslock raidmon smb vsftpd
apmd dc_server gpm isdn microcode_ctl nscd random snmpd webmin
arptables_jf dellomsa halt kdcrotate mysql ntpd rawdevices snmptrapd winbind
atd dellomsaesm hpoj killall named omawsd rhnsd spamassassin xfs
autofs dhcpd httpd kudzu netdump pcmcia saslauthd squid xinetd
bcm5820 dhcrelay httpd.lock lisa netdump-server portmap sendmail sshd ypbind
canna dkms_autoinstaller ip6tables MailScanner netfs postfix sendmail-copy syslog yppasswdd
crond firstboot iptables mdmonitor network proftpd single tux ypserv
cups FreeWnn irda mdmpd nfs psacct smartd vncserver ypxfrd
2. cat /etc/init.d/sendmail shows:
#!/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/mail/sendmail.cf
# pidfile: /var/run/sendmail.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Source sendmail configureation.
if [ -f /etc/sysconfig/sendmail ] ; then
. /etc/sysconfig/sendmail
else
DAEMON=no
QUEUE=1h
fi
[ -z "$SMQUEUE" ] && SMQUEUE="$QUEUE"
[ -z "$SMQUEUE" ] && SMQUEUE=1h
# 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: "
if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
make all -C /etc/mail -s
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/bin/newaliases > /dev/null 2>&1
daemon /usr/sbin/sendmail $([ "x$DAEMON" = xyes ] && echo -bd) \
$([ -n "$QUEUE" ] && echo -q$QUEUE) $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
if ! test -f /var/run/sm-client.pid ; then
echo -n $"Starting sm-client: "
touch /var/run/sm-client.pid
chown smmsp:smmsp /var/run/sm-client.pid
daemon --check sm-client /usr/sbin/sendmail -L sm-msp-queue -Ac \
-q $SMQUEUE $SENDMAIL_OPTARG
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sm-client
fi
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc sendmail
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
if test -f /var/run/sm-client.pid ; then
echo -n $"Shutting down sm-client: "
killproc sm-client
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/run/sm-client.pid
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sm-client
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/sendmail ]; then
stop
start
RETVAL=$?
fi
;;
status)
status sendmail
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condre
exit 1
esac
exit $RETVAL
Okay, I should have also asked to see what's in /etc/init.d/MailScanner.
ASKER
It contains:
#!/bin/bash
#
# 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/MailScann er.conf
# pidfile: /var/run/MailScanner.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
#
# If you are using sendmail, Exim or Postfix, please try to avoid editing
# thie file. Edit /etc/sysconfig/MailScanner instead.
#
MTA=sendmail
QUEUETIME=15m
WORKDIR=/var/spool/MailSca nner/incom ing
INQDIR=/var/spool/mqueue.i n
INPID=/var/run/sendmail.in .pid
OUTPID=/var/run/sendmail.o ut.pid
SMPID=/var/run/sm-client.p id
MSPUSER=smmsp
MSPGROUP=smmsp
SENDMAIL=/usr/sbin/sendmai l
POSTFIX=/usr/sbin/postfix
POSTFIXINCF=/etc/postfix.i n
POSTFIXOUTCF=/etc/postfix
EXIM=/usr/sbin/exim
EXIMINCF=/etc/exim.conf
EXIMSENDCF=/etc/exim_send. conf
ZMAILER=/usr/lib/zmailer/z mailer
ZMAILERCF=/etc/zmailer/zma iler.conf
RESTART_DELAY=10
# Source mailscanner configuration.
if [ -f /etc/sysconfig/MailScanner ] ; then
. /etc/sysconfig/MailScanner
fi
export MTA
export QUEUETIME
export WORKDIR
export INQDIR
export INPID
export OUTPID
export SMPID
export MSPUSER
export MSPGROUP
export SENDMAIL
export POSTFIX
export POSTFIXINCF
export POSTFIXOUTCF
export EXIM
export EXIMINCF
export EXIMSENDCF
export ZMAILER
export ZMAILERCF
export RESTART_DELAY
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/check_MailScanne r ] || exit 0
[ -f $SENDMAIL ] || exit 0
if [ $MTA = 'zmailer' ]; then
# Source zmailer configuration.
if [ -f $ZMAILERCF ]; then
. $ZMAILERCF
else
echo "Missing ZMailer configuration file: $ZMAILERCF"
exit 1
fi
if [ ! -f $MAILBIN/zmailer ]; then
echo "Missing main ZMailer script: $MAILBIN/zmailer"
fi
if [ -z $POSTOFFICEIN ]; then
echo "Incoming postoffice not defined in $ZMAILERCF - patch zmailer configuration"
exit 1
fi
fi
# Start both the sendmail processes
StartInSendmail() {
if [ $MTA = 'postfix' ]; then
if test -x $POSTFIX ; then
if [ -f $POSTFIXINCF/main.cf ]; then
$POSTFIX -c $POSTFIXINCF start 2> /dev/null
fi
success
echo
else
success
echo
echo "Assuming you are using a single Postfix instance (hold queue method)"
fi
elif [ $MTA = 'exim' ]; then
if test -x $EXIM ; then
$EXIM -C $EXIMINCF -bd 2> /dev/null
success
echo
else
failure
echo
echo "Could not find Exim installation, see /etc/sysconfig/MailScanner "
fi
elif [ $MTA = 'sendmail' ]; then
/usr/bin/newaliases > /dev/null 2>&1
if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
make -C /etc/mail -s
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
$SENDMAIL -bd -OPrivacyOptions=noetrn \
-ODeliveryMode=queueonly \
-OQueueDirectory=$INQDIR \
-OPidFile=$INPID
touch /var/run/sm-client.pid
chown $MSPUSER:$MSPGROUP /var/run/sm-client.pid 2>/dev/null
$SENDMAIL -L sm-msp-queue -Ac -q15m -OPidFile=$SMPID 2>/dev/null
success
echo
elif [ $MTA = 'zmailer' ]; then
$MAILBIN/zmailer smtpserver >/tmp/zmailer_start_output .$$ 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
echo
else
failure
echo
cat /tmp/zmailer_start_output. $$
fi
rm -f /tmp/zmailer_start_output. $$
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner "
fi
}
StartOutSendmail() {
if [ $MTA = 'postfix' ]; then
if test -x $POSTFIX -a -f $POSTFIXOUTCF/main.cf ; then
$POSTFIX -c $POSTFIXOUTCF start 2> /dev/null
success
echo
else
failure
echo
echo "Could not find Postfix installation, see /etc/sysconfig/MailScanner "
fi
elif [ $MTA = 'exim' ]; then
if test -x $EXIM ; then
$EXIM -C $EXIMSENDCF -q15m 2> /dev/null
success
echo
else
failure
echo
echo "Could not find Exim installation, see /etc/sysconfig/MailScanner "
fi
elif [ $MTA = 'sendmail' ]; then
$SENDMAIL $([ -n "$QUEUETIME" ] && echo -q$QUEUETIME) \
-OPidFile=$OUTPID
success
echo
elif [ $MTA = 'zmailer' ]; then
$MAILBIN/zmailer router scheduler >/tmp/zmailer_start_output .$$ 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
echo
else
failure
echo
cat /tmp/zmailer_start_output. $$
fi
rm -f /tmp/zmailer_start_output. $$
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner "
fi
}
RETVAL=0
# See how we were called.
case "$1" in
startin)
# Start just incoming sendmail
echo "Starting incoming $MTA only:"
echo -n ' incoming' $MTA': '
StartInSendmail
;;
startout)
# Start just outgoing sendmail
echo "Starting outgoing $MTA only:"
echo -n ' outgoing' $MTA': '
StartOutSendmail
;;
start)
# Start daemons.
echo 'Starting MailScanner daemons:'
echo -n ' incoming' $MTA': '
StartInSendmail
echo -n ' outgoing' $MTA': '
StartOutSendmail
echo -n ' MailScanner: '
/usr/sbin/check_MailScanne r >/dev/null
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScann er
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScann er.off
success
echo
;;
stop)
# Stop daemons.
echo 'Shutting down MailScanner daemons:'
echo -n ' MailScanner: '
killproc MailScanner -15
echo
echo -n ' incoming' $MTA': '
if [ $MTA = "postfix" ]; then
if [ -f $POSTFIXINCF/main.cf ]; then
$POSTFIX -c $POSTFIXINCF stop 2> /dev/null
fi
success
elif [ $MTA = "exim" ]; then
killproc exim 2>/dev/null
success
elif [ $MTA = "sendmail" ]; then
#killproc sendmail 2>/dev/null
kill `head -1 $INPID` 2>/dev/null
kill `head -1 /var/run/sm-client.pid` 2>/dev/null
success
elif [ $MTA = "zmailer" ]; then
$MAILBIN/zmailer stop smtpserver >/tmp/zmailer_stop_output. $$ 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
else
failure
echo
cat /tmp/zmailer_stop_output.$ $
fi
rm -f /tmp/zmailer_stop_output.$ $
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner "
fi
echo
echo -n ' outgoing' $MTA': '
if [ $MTA = "postfix" ]; then
$POSTFIX -c $POSTFIXOUTCF stop 2>/dev/null
success
elif [ $MTA = "exim" ]; then
success
elif [ $MTA = "sendmail" ]; then
#killproc /usr/sbin/sendmail 2>/dev/null
kill `head -1 $OUTPID` 2>/dev/null
success
elif [ $MTA = "zmailer" ]; then
$MAILBIN/zmailer stop router scheduler >/tmp/zmailer_stop_output. $$ 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
else
failure
echo
cat /tmp/zmailer_stop_output.$ $
fi
rm -f /tmp/zmailer_stop_output.$ $
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner "
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScann er
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScann er.off
# Clear out all the old pid files
rm -f /var/run/MailScanner.pid
# Clear out the old incoming dirs
cd $WORKDIR && ls | egrep '^[0123456789]+$' | xargs /bin/rm -rf 2>/dev/null
;;
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
if [ $MTA = "sendmail" ]; then
# Now the incoming sendmail
echo -n ' incoming sendmail: '
pid=`head -1 $INPID`
alive=`ps ax | awk '{ print $1 }' | grep '^'$pid'$'`
#pid=`ps ax | egrep '\[sendmail\]|sendmai[l]: accepting connections'`
if [ -z "$alive" ] ; then failure; else success; fi
echo
# Now the outgoing sendmail
echo -n ' outgoing sendmail: '
pid=`head -1 $OUTPID`
alive=`ps ax | awk '{ print $1 }' | grep '^'$pid'$'`
# More complex regexp to handle other RedHats
#pid=`ps ax | egrep '\[sendmail\]|sendmai[l] -q[0-9]*[mhd]|sendmail: Queue runner' | grep -v grep`
if [ -z "$alive" ] ; then failure; else success; fi
echo
elif [ $MTA = "zmailer" ]; then
echo -n ' incoming zmailer: '
if ( status smtpserver ) | grep stop > /dev/null ; then
failure
else
success
fi
echo
echo -n ' outgoing zmailer: '
if ( status scheduler || status router ) | grep stop > /dev/null ; then
failure
else
success
fi
echo
fi
;;
reload)
echo 'Reloading MailScanner workers:'
echo -n ' MailScanner: '
pid=`pidofproc MailScanner`
if [ -z "$pid" ] ; then
failure
else
/bin/kill -HUP -- -$pid
success
fi
echo
if [ $MTA = "postfix" ]; then
echo -n ' Incoming postfix: '
$POSTFIX -c $POSTFIXINCF reload >/dev/null
success
echo
echo -n ' Outgoing postfix: '
$POSTFIX -c $POSTFIXOUTCF reload >/dev/null
success
echo
fi
;;
restart)
$0 stop
sleep $RESTART_DELAY
$0 start
RETVAL=$?
;;
*)
echo "Usage: service MailScanner {start|stop|status|restart |reload|st artin|star tout}"
exit 1
esac
exit $RETVAL
#!/bin/bash
#
# 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/MailScann
# pidfile: /var/run/MailScanner.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
#
# If you are using sendmail, Exim or Postfix, please try to avoid editing
# thie file. Edit /etc/sysconfig/MailScanner
#
MTA=sendmail
QUEUETIME=15m
WORKDIR=/var/spool/MailSca
INQDIR=/var/spool/mqueue.i
INPID=/var/run/sendmail.in
OUTPID=/var/run/sendmail.o
SMPID=/var/run/sm-client.p
MSPUSER=smmsp
MSPGROUP=smmsp
SENDMAIL=/usr/sbin/sendmai
POSTFIX=/usr/sbin/postfix
POSTFIXINCF=/etc/postfix.i
POSTFIXOUTCF=/etc/postfix
EXIM=/usr/sbin/exim
EXIMINCF=/etc/exim.conf
EXIMSENDCF=/etc/exim_send.
ZMAILER=/usr/lib/zmailer/z
ZMAILERCF=/etc/zmailer/zma
RESTART_DELAY=10
# Source mailscanner configuration.
if [ -f /etc/sysconfig/MailScanner
. /etc/sysconfig/MailScanner
fi
export MTA
export QUEUETIME
export WORKDIR
export INQDIR
export INPID
export OUTPID
export SMPID
export MSPUSER
export MSPGROUP
export SENDMAIL
export POSTFIX
export POSTFIXINCF
export POSTFIXOUTCF
export EXIM
export EXIMINCF
export EXIMSENDCF
export ZMAILER
export ZMAILERCF
export RESTART_DELAY
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/check_MailScanne
[ -f $SENDMAIL ] || exit 0
if [ $MTA = 'zmailer' ]; then
# Source zmailer configuration.
if [ -f $ZMAILERCF ]; then
. $ZMAILERCF
else
echo "Missing ZMailer configuration file: $ZMAILERCF"
exit 1
fi
if [ ! -f $MAILBIN/zmailer ]; then
echo "Missing main ZMailer script: $MAILBIN/zmailer"
fi
if [ -z $POSTOFFICEIN ]; then
echo "Incoming postoffice not defined in $ZMAILERCF - patch zmailer configuration"
exit 1
fi
fi
# Start both the sendmail processes
StartInSendmail() {
if [ $MTA = 'postfix' ]; then
if test -x $POSTFIX ; then
if [ -f $POSTFIXINCF/main.cf ]; then
$POSTFIX -c $POSTFIXINCF start 2> /dev/null
fi
success
echo
else
success
echo
echo "Assuming you are using a single Postfix instance (hold queue method)"
fi
elif [ $MTA = 'exim' ]; then
if test -x $EXIM ; then
$EXIM -C $EXIMINCF -bd 2> /dev/null
success
echo
else
failure
echo
echo "Could not find Exim installation, see /etc/sysconfig/MailScanner
fi
elif [ $MTA = 'sendmail' ]; then
/usr/bin/newaliases > /dev/null 2>&1
if test -x /usr/bin/make -a -f /etc/mail/Makefile ; then
make -C /etc/mail -s
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
$SENDMAIL -bd -OPrivacyOptions=noetrn \
-ODeliveryMode=queueonly \
-OQueueDirectory=$INQDIR \
-OPidFile=$INPID
touch /var/run/sm-client.pid
chown $MSPUSER:$MSPGROUP /var/run/sm-client.pid 2>/dev/null
$SENDMAIL -L sm-msp-queue -Ac -q15m -OPidFile=$SMPID 2>/dev/null
success
echo
elif [ $MTA = 'zmailer' ]; then
$MAILBIN/zmailer smtpserver >/tmp/zmailer_start_output
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
echo
else
failure
echo
cat /tmp/zmailer_start_output.
fi
rm -f /tmp/zmailer_start_output.
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner
fi
}
StartOutSendmail() {
if [ $MTA = 'postfix' ]; then
if test -x $POSTFIX -a -f $POSTFIXOUTCF/main.cf ; then
$POSTFIX -c $POSTFIXOUTCF start 2> /dev/null
success
echo
else
failure
echo
echo "Could not find Postfix installation, see /etc/sysconfig/MailScanner
fi
elif [ $MTA = 'exim' ]; then
if test -x $EXIM ; then
$EXIM -C $EXIMSENDCF -q15m 2> /dev/null
success
echo
else
failure
echo
echo "Could not find Exim installation, see /etc/sysconfig/MailScanner
fi
elif [ $MTA = 'sendmail' ]; then
$SENDMAIL $([ -n "$QUEUETIME" ] && echo -q$QUEUETIME) \
-OPidFile=$OUTPID
success
echo
elif [ $MTA = 'zmailer' ]; then
$MAILBIN/zmailer router scheduler >/tmp/zmailer_start_output
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
echo
else
failure
echo
cat /tmp/zmailer_start_output.
fi
rm -f /tmp/zmailer_start_output.
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner
fi
}
RETVAL=0
# See how we were called.
case "$1" in
startin)
# Start just incoming sendmail
echo "Starting incoming $MTA only:"
echo -n ' incoming' $MTA': '
StartInSendmail
;;
startout)
# Start just outgoing sendmail
echo "Starting outgoing $MTA only:"
echo -n ' outgoing' $MTA': '
StartOutSendmail
;;
start)
# Start daemons.
echo 'Starting MailScanner daemons:'
echo -n ' incoming' $MTA': '
StartInSendmail
echo -n ' outgoing' $MTA': '
StartOutSendmail
echo -n ' MailScanner: '
/usr/sbin/check_MailScanne
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScann
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScann
success
echo
;;
stop)
# Stop daemons.
echo 'Shutting down MailScanner daemons:'
echo -n ' MailScanner: '
killproc MailScanner -15
echo
echo -n ' incoming' $MTA': '
if [ $MTA = "postfix" ]; then
if [ -f $POSTFIXINCF/main.cf ]; then
$POSTFIX -c $POSTFIXINCF stop 2> /dev/null
fi
success
elif [ $MTA = "exim" ]; then
killproc exim 2>/dev/null
success
elif [ $MTA = "sendmail" ]; then
#killproc sendmail 2>/dev/null
kill `head -1 $INPID` 2>/dev/null
kill `head -1 /var/run/sm-client.pid` 2>/dev/null
success
elif [ $MTA = "zmailer" ]; then
$MAILBIN/zmailer stop smtpserver >/tmp/zmailer_stop_output.
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
else
failure
echo
cat /tmp/zmailer_stop_output.$
fi
rm -f /tmp/zmailer_stop_output.$
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner
fi
echo
echo -n ' outgoing' $MTA': '
if [ $MTA = "postfix" ]; then
$POSTFIX -c $POSTFIXOUTCF stop 2>/dev/null
success
elif [ $MTA = "exim" ]; then
success
elif [ $MTA = "sendmail" ]; then
#killproc /usr/sbin/sendmail 2>/dev/null
kill `head -1 $OUTPID` 2>/dev/null
success
elif [ $MTA = "zmailer" ]; then
$MAILBIN/zmailer stop router scheduler >/tmp/zmailer_stop_output.
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
success
else
failure
echo
cat /tmp/zmailer_stop_output.$
fi
rm -f /tmp/zmailer_stop_output.$
else
failure
echo
echo "Invalid MTA in /etc/sysconfig/MailScanner
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/MailScann
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/MailScann
# Clear out all the old pid files
rm -f /var/run/MailScanner.pid
# Clear out the old incoming dirs
cd $WORKDIR && ls | egrep '^[0123456789]+$' | xargs /bin/rm -rf 2>/dev/null
;;
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
if [ $MTA = "sendmail" ]; then
# Now the incoming sendmail
echo -n ' incoming sendmail: '
pid=`head -1 $INPID`
alive=`ps ax | awk '{ print $1 }' | grep '^'$pid'$'`
#pid=`ps ax | egrep '\[sendmail\]|sendmai[l]: accepting connections'`
if [ -z "$alive" ] ; then failure; else success; fi
echo
# Now the outgoing sendmail
echo -n ' outgoing sendmail: '
pid=`head -1 $OUTPID`
alive=`ps ax | awk '{ print $1 }' | grep '^'$pid'$'`
# More complex regexp to handle other RedHats
#pid=`ps ax | egrep '\[sendmail\]|sendmai[l] -q[0-9]*[mhd]|sendmail: Queue runner' | grep -v grep`
if [ -z "$alive" ] ; then failure; else success; fi
echo
elif [ $MTA = "zmailer" ]; then
echo -n ' incoming zmailer: '
if ( status smtpserver ) | grep stop > /dev/null ; then
failure
else
success
fi
echo
echo -n ' outgoing zmailer: '
if ( status scheduler || status router ) | grep stop > /dev/null ; then
failure
else
success
fi
echo
fi
;;
reload)
echo 'Reloading MailScanner workers:'
echo -n ' MailScanner: '
pid=`pidofproc MailScanner`
if [ -z "$pid" ] ; then
failure
else
/bin/kill -HUP -- -$pid
success
fi
echo
if [ $MTA = "postfix" ]; then
echo -n ' Incoming postfix: '
$POSTFIX -c $POSTFIXINCF reload >/dev/null
success
echo
echo -n ' Outgoing postfix: '
$POSTFIX -c $POSTFIXOUTCF reload >/dev/null
success
echo
fi
;;
restart)
$0 stop
sleep $RESTART_DELAY
$0 start
RETVAL=$?
;;
*)
echo "Usage: service MailScanner {start|stop|status|restart
exit 1
esac
exit $RETVAL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did what you said.. but the error still shows :
Nov 23 10:09:56 master MailScanner[15434]: Failed to link message body between queues (/var/spool/mqueue/dfiANF9 pRQ017847 --> /var/spool/mqueue.in/dfiAN F9pRQ01784 7)
:-( ... what could it be??.
Nov 23 10:09:56 master MailScanner[15434]: Failed to link message body between queues (/var/spool/mqueue/dfiANF9
:-( ... what could it be??.
What does 'ps -efw | grep sendmail | grep -v grep' and 'ps -efw | grep MailScanner | grep -v grep' show?
ASKER
'ps -efw | grep sendmail | grep -v grep' and 'ps -efw shows:
root 15369 1 0 09:32 ? 00:00:00 sendmail: accepting connections
smmsp 15373 1 0 09:32 ? 00:00:00 sendmail: Queue runner@00:15:00 for /var/spool/clientmqueue
root 15378 1 0 09:32 ? 00:00:00 sendmail: Queue runner@00:15:00 for /var/spool/mqueue
'ps -efw | grep MailScanner | grep -v grep' shows:
root 15397 1 0 09:32 ? 00:00:00 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann er.conf
root 15398 15397 0 09:32 ? 00:00:12 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann er.conf
root 15409 15397 0 09:32 ? 00:00:12 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann er.conf
root 15430 15397 0 09:32 ? 00:00:15 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann er.conf
root 15434 15397 0 09:33 ? 00:00:16 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann er.conf
root 15439 15397 0 09:33 ? 00:00:15 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann er.conf
root 15369 1 0 09:32 ? 00:00:00 sendmail: accepting connections
smmsp 15373 1 0 09:32 ? 00:00:00 sendmail: Queue runner@00:15:00 for /var/spool/clientmqueue
root 15378 1 0 09:32 ? 00:00:00 sendmail: Queue runner@00:15:00 for /var/spool/mqueue
'ps -efw | grep MailScanner | grep -v grep' shows:
root 15397 1 0 09:32 ? 00:00:00 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann
root 15398 15397 0 09:32 ? 00:00:12 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann
root 15409 15397 0 09:32 ? 00:00:12 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann
root 15430 15397 0 09:32 ? 00:00:15 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann
root 15434 15397 0 09:33 ? 00:00:16 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann
root 15439 15397 0 09:33 ? 00:00:15 /usr/bin/perl -I/usr/lib/MailScanner /usr/sbin/MailScanner /etc/MailScanner/MailScann
ASKER
What about if try reinstalling sendmail??..
I don't see anything that suggests that it is a sendmail problem, per se. So reinstalling Sendmail would be a waste of time. I'm looking at the code in MailScanner to see if I can figure out how this might happen.
ASKER
i don't have /etc/alternatives/mta-send mail.. the webmin can't access to sendmail now it says /usr/lib/sendmail isn't installed... is it something about the errors?? how to make webmin to work properly with sendmail??
ASKER
Sorry.. i just re-installed webmin and that problem was solved.
Hmm, I don't think that webmin is "MailScanner aware" and it may be the cause of the problem. And the fact that you don't have /etc/alternatives/mta-send mail, which is the default for an RH 9 sendmail installation makes me wonder if the root of your problems might be webmin.
What does 'rpm -q --verify sendmail' show?
What does 'rpm -q --verify sendmail' show?
ASKER
It Shows:
S.5....T c /etc/aliases
S.5....T c /etc/mail/access
S.5....T c /etc/mail/local-host-names
S.5....T c /etc/mail/sendmail.cf
S.5....T c /etc/mail/sendmail.mc
S.5....T c /etc/mail/statistics
missing c /etc/pam.d/smtp
missing /usr/lib/sendmail
S.5....T c /etc/aliases
S.5....T c /etc/mail/access
S.5....T c /etc/mail/local-host-names
S.5....T c /etc/mail/sendmail.cf
S.5....T c /etc/mail/sendmail.mc
S.5....T c /etc/mail/statistics
missing c /etc/pam.d/smtp
missing /usr/lib/sendmail
Something has screwed up the sendmail installation and it bet on it being webmin. But what's been futzed with doesn't explain the errors being logged unless webmin is starting another instance of sendmail. The next time you are seeing the errors in the maillog I'd like to see what 'ps -efw | grep sendmail | grep -v grep' shows.
Are /var/spool/mqueue & /var/spool/mqueue.in on the same file system? And assuming that is the case could you be running out of space or inodes in /var/spool (check with 'df -k /var/spool' & 'df -i /var/spool').