MS4.x config/runtime issues

David Lee t.d.lee at DURHAM.AC.UK
Thu Nov 21 14:48:06 GMT 2002

On Thu, 7 Nov 2002, Julian Field wrote:

> At 17:18 07/11/2002, you wrote:
> [...]
> >3. With v3, I had had the default (and sensible!):
> >       Outgoing Queue Dir = /var/spool/mqueue
> >
> >    To ensure co-residency on the same physical partition of the other
> >    directories, they had been subdirectories of this:
> >       Incoming Queue Dir = /var/spool/mqueue/
> >       Incoming Work Dir = /var/spool/mqueue/incoming
> >       Quarantine Dir = /var/spool/mqueue/quarantine
> >    Solid and safe.
> Interesting setup, hadn't occurred to me that people might do that.
> >    Further, the standard "/var/spool/mqueue" (i.e. "Outgoing Queue Dir")
> >    was also a separate partition for ease of system maintenance (including
> >    possible OS replacement).  So it also contained a "lost+found".
> >
> >    But under v4 this gives errors:
> >       Queue directory /var/spool/mqueue cannot contain sub-directories,
> >       currently contains dir lost+found at
> >       /opt/MailScanner/bin/MailScanner/ line 839
> >
> >    (Presumably each of the other directories could also have given an
> >    analogous message, had it got that far.)
> >
> >    Is there any reason why v4.x forbids such subdirectory use?
> >    (Note that the apparently simple solution of making the partition
> >    "/var/spool" instead of "/var/spool/mqueue" makes OS replacement
> >    potentially more tricky, as "/var/spool" contians "system" things other
> >    than mqueue.
> >
> >    Does MailScanner really require this restriction?  Can it be removed?
> I thought it was a good idea at the time, but setups such as yours hadn't
> occurred to me. On reflection it may be better to remove the check. I will
> still look for a q1 or qf directory though, in an attempt to find split
> queue directories which sendmail will use if it finds them. So you can get
> it going now, the minimal patch to is attached to this message.
> There is actually just 1 extra line of code.

That was excellent.  Thanks.  We have had it running in production on our
three Solaris servers (each of 60K-120K msgs/day) for nearly two weeks.

Which leads me to... a patch to make this more flexible per-site.

We are about to migrate this service from Solaris to Linux.  (Upside: the
hardware is cheaper;  downside: I've got to learn Redhat.)  It is going
reasonably well.  I find that everything is in a different location, but
I'm trying to stay with the Redhat/RPM defaults as far as possible.

But I would very much like to keep the above scheme: that is, all the MS
directories (incoming, outgoing, work, quarantine) in a single partition
and as subdirectories of "/var/spool/mqueue".

Now these specifications appear not only in the MailScanner.conf file, but
some also appear in the startup script "/etc/rc.d/init.d/MailScanner".
And that script itself has possible overrides of its data values from

Editing a script to tweak its data variables feels wrong.  Especially so
when that script itself reads very similar data from a file.

The patch below attempts to begin to rationalise this, to add per-site
flexibility, whilst reducing the need to edit the script itself to achieve
this.  (Based on 4.05-3 RPM download.)

======================== snip ====================
*** /etc/rc.d/init.d/MailScanner.orig   Sun Nov  3 22:45:18 2002
--- /etc/rc.d/init.d/MailScanner        Thu Nov 21 14:02:01 2002
*** 15,30 ****
  # 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
-       WORKDIR=/var/spool/MailScanner/incoming
-         export QUEUETIME
-         export PIDDIR
-         export WORKDIR

  # Check that networking is up.
--- 15,35 ----
  # Source networking configuration.
  . /etc/sysconfig/network

! # Some default values
! PIDDIR=/var/run/MailScanner
! INDIR=/var/spool/
! OUTDIR=/var/spool/mqueue
! WORKDIR=/var/spool/MailScanner/incoming
! export QUEUETIME
! export PIDDIR
! export INDIR
! export OUTDIR
! export WORKDIR
! # Source mailscanner configuration.
  if [ -f /etc/sysconfig/MailScanner ] ; then
          . /etc/sysconfig/MailScanner

  # Check that networking is up.
*** 54,65 ****
          /usr/sbin/sendmail -bd -ODeliveryMode=queueonly \
!                            -OQueueDirectory=/var/spool/
  StartOutSendmail() {
!         /usr/sbin/sendmail $([ -n "$QUEUETIME" ] && echo -q$QUEUETIME)
--- 59,70 ----
          /usr/sbin/sendmail -bd -ODeliveryMode=queueonly \
!                            -OQueueDirectory=$INDIR
  StartOutSendmail() {
!         /usr/sbin/sendmail -OQueueDirectory=$OUTDIR $([ -n "$QUEUETIME" ] && echo -q$QUEUETIME)
======================== snip ====================

First, it adds INDIR and OUTDIR to the list of variables.

Second, it extracts them outside the "if ..." so that they are set, as
defaults, regardless.  Then "/etc/sysconfig/MailScanner" can override
some or all of them, as the site wishes, without diddling with the script.

Finally, it then employs the new INDIR and OUTDIR variables in the
sendmail start-ups.

So it enhances flexibility and reduces (eliminates?) the need to per-site
tailor the script (only tailor data file "/etc/sysconfig/MailScanner").

[One possible additional step would be to extract (grep?) these variables
(INDIR, OUTDIR, WORKDIR, PIDDIR) out of the MailScanner.conf file.  But
that would be a large technical change with relatively little payoff.]

Seem OK?  I like it (but I would say that, wouldn't I?)

Incidentally, and changing subject, the "Convert Dangerous HTML To Text"
in the pre-release 4.06 I've been running on Solaris is going very well.
The local guinea-pig users are very grateful!  Herewith their thanks,


:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :

More information about the MailScanner mailing list