Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ncr-sd!mattc From: mattc@ncr-sd.SanDiego.NCR.COM (Matt Costello) Newsgroups: comp.mail.uucp Subject: Re: Rerouting spooled UUCP mail (HDB+smail) Message-ID: <3038@ncr-sd.SanDiego.NCR.COM> Date: 27 Nov 90 19:04:24 GMT References: <17525@netcom.UUCP> Reply-To: mattc@ncr-sd.SanDiego.NCR.COM (Matt Costello) Organization: NCR Corporation, Rancho Bernardo Lines: 61 Here is another shell script to reroute mail queued up in an outgoing UUCP spool directory. It performs the same function as the script posted by Gordon Moffett but it uses "uustat -s system" so it doesn't mess around in the bowels of UUCP. This makes it a whole lot simpler and safer. Just change the shell procedure definition for mail() to match what your MTA needs. ---------------------------- snip here ---------------------------- #!/bin/sh # uureroute.sh host # # This is a Honey DanBer specific routine to reroute all mail queued up # for a specific host. It needs to be run as "root" since uucp will not # allow itself to remove others requests. # if [ $# = 0 ] then echo "Usage: uureroute host" 1>&2 exit 2 fi for system do if cd /usr/spool/uucp/$system then : "all okay" else echo "$0: nothing queued for $system" 1>&2 fi uustat -s $system | \ awk ' BEGIN { print "set -ex" print "mail() /usr/lib/mail/smail -R1 $*" } /^[a-z]/ { jobid = $1 ; datafile = $7 } /^ / { if ( $5 != "rmail" ) next dest = "" for ( i = 6; i <= NF; i++ ) { if ($i ~ /@/) { n = split( $i, ary, "@" ); dest = "" dest " '$system'!" ary[1] } else { dest = "" dest " '$system'!" $i } } printf "mail %s < %s && uustat -k %s\n", \ dest, datafile, jobid } ' | /bin/sh done ---------------------------- snip here ---------------------------- -- Matthew Costello +1 619 485 2926 uunet!ncrlnk!ncr-sd!mattc