Hi all,
I've managed to come up with a workable solution for my "problem" without
doing any serious coding.
Basically, I have setup a virtualdomain and dump all unrecognised addresses
into a default Maildir and then use maildirsmtp to transfer all the dumped
messages to the ms-mail host.
The clever bit is running maildirsmtp under supervise so it effectively sits
there scanning the default Maildir every second or so. This setup is fine
for our purposes - it would probably begin to creak under a high load, but
we're only on 64Kbs line so I doubt that we'll ever run into a load problem!
I pinched the idea from Keith Burdis' sdeliver script but re-wrote it as a
shell script like Mate Wierdl's initscripts.
Here's the script:
#! /bin/sh -
# $INITDIR/sdeliver.sh
# INITDIR is defined below
# Tue Nov 02 1999
#
# chkconfig: 345 80 45
# description: Starts a process that constantly runs maildirstmp to relay
# mail from the eoc.org.uk virtual domain to the MS
Mail
# gateway machine.
# Makes heavy use of parts of DJB's daemontools package \
# It also relies upon daemontools.functions for 91.04982% \
# of the grunt work.
#
# [EMAIL PROTECTED]:
# created from a combination of mw's initscripts and Keith Burdis'
# sdeliver v0.3
# [EMAIL PROTECTED]:
# small fixes and modifications
# Lars Uffman:
# removed mkdirs
# customize
HELOHOST=candace.eoc.org.uk
DOMAINMAILDIR=/home/vpopmail/domains/eoc.org.uk/domain-default/Maildir
MAILPREFIX=eoc.org.uk-
MAILRELAY=ms-mail.eoc.org.uk
PROG=maildirsmtp # what program?
DIR=/var/lock/$PROG # a directory for supervise to use
LOGDIR=/var/log/$PROG # directory for logs
LOGUSER=qmaill # user to own logs
LOGSIZE="-s 1000000" # size of logfile
INITDIR=/usr/local/etc/rc.d # location of initscripts
# Grab the daemontools init functions
. $INITDIR/daemontools.functions
export PATH=/usr/local/bin:$PATH
start() {
if check; then
echo "$PROG is already running"
else
echo -n "Starting $PROG..."
supervise $DIR $PROG $DOMAINMAILDIR $MAILPREFIX $MAILRELAY $HELOHOST 2>&1
\
| accustamp $PROG | setuser $LOGUSER cyclog $LOGSIZE $LOGDIR &
echo "done"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
help)
help
;;
*)
signal $1
;;
esac
Works very nicely and won't lose any mail!
R.