LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] mail hubs revisited...

[ILUG] mail hubs revisited...

kevin lyda kevin at suberic.net
Tue Nov 21 09:09:15 GMT 2000


this is my solution.  thanks for the other suggestions, but i don't
have root access to the machine that is my mailhub.  kenn humborg's
uucp obsession, which i share, is to be credited for seeding the idea
that led to this, however i should mention that kenn had nothing to
do with the actual scripts or the solution.  i think he'd kill me if
i implied otherwise.

obviously if you find these useful, psychiatric help is not an unthinkable
option.

anyway, uucp to the mailhub via shell script uucp:

these changes to my sendmail.mc:
    dnl UUCP hack - edit mailer/uucp.m4.  append " U=kevin:kevin," to the
    dnl line starting with Muucp-dom
    define(`UUCP_MAILER_PATH', /home/kevin/bin/suux)
    define(`UUCP_MAILER_ARGS', `suux $u')
    define(`SMART_HOST', `uucp-dom:suberic')

and at the end of the file:
    MAILER(uucp)

then there are these three utilities: suux, suuq, smail (uploaded to the
mail hub and then run once every 5 minutes).

suux:
    #!/bin/sh
    SPOOL=/home/kevin/.suux.spool

    locked=0
    while [ $locked -eq 0 ]; do
	lock=`mktemp $SPOOL/mail.XXXXXX`
	rcpt=$lock.rcpt
	body=$lock.body
	if [ ! -f $rcpt -a ! -f $body ] ; then
	    rm $lock
	    locked=1
	fi
    done
    echo "$*" > $rcpt
    cat > $body
    rm $lock
    exit 0

suuq:
    #!/bin/sh
    SPOOL=/home/kevin/.suux.spool
    RDIR=.suux.spool
    RSPOOL=suberic.net:$RDIR

    # work to do?
    cd $SPOOL || exit 1
    lockfile -r 10 process.lock || exit 1
    files=`echo *.rcpt`
    if [ "$files" = "*.rcpt" ]; then
	rm -f process.lock
	exit 0
    fi

    # get messages to upload to suberic.
    for rcpt in *.rcpt; do
	lock=`basename $rcpt .rcpt`
	if [ ! -f $lock ]; then
	    body=$lock.body
	    touch $lock
	    scp -q $lock $rcpt $body $RSPOOL/ && rm $lock $rcpt $body
	    ssh suberic.net -C rm $RDIR/$lock
	fi
    done
    rm -f process.lock

smail:
    #!/bin/sh
    SPOOL=/home/kevin/.suux.spool

    # work to do?
    cd $SPOOL || exit 1
    lockfile -r 10 process.lock || exit 1
    files=`echo *.rcpt`
    if [ "$files" = "*.rcpt" ]; then
	rm -f process.lock
	exit 0
    fi

    # send messages
    for rcpt in *.rcpt; do
	lock=`basename $rcpt .rcpt`
	if [ ! -f $lock ]; then
	    body=$lock.body
	    cat $body | /usr/lib/sendmail -oi `cat $rcpt` && rm $body $rcpt
	fi
    done
    rm -f process.lock

kevin

-- 
kevin at suberic.net        q: what's the difference between batman & b. gates?
fork()'ed on 37058400    a: when batman fought the penguin, he won.
meatspace place: home                             http://suberic.net/~kevin/
 >> want privacy? www.gnupg.org or www.pgp.com.  encrypted mail preferred <<




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell