home *** CD-ROM | disk | FTP | other *** search
- From: hyc@umix.UUCP (Howard Chu)
- Newsgroups: comp.sources.misc
- Subject: Batching news for mailing
- Message-ID: <3655@ncoast.UUCP>
- Date: 28 Jul 87 00:25:20 GMT
- Sender: allbery@ncoast.UUCP
- Organization: University of Michigan Computing Center, Ann Arbor, MI
- Lines: 68
- Approved: allbery@ncoast.UUCP
- X-Archive: comp.sources.misc/8707/69
-
- I was recently faced with the problem of supplying Usenet articles
- to hosts without access to uucp or nntp, only mail. I set up a mailing
- list to send to, and to keep from having to send zillions of tiny
- messages, I set it up using the batching mechanism of news. Anyway,
- I wrote up a little script to collect the batched news and mail it out
- in the form of an ARPAnet digest, and thought it might be useful enough
- to share with the world... [I sure wish the Info-Apple moderator would
- do something like this. 50 messages a day from that list is getting to
- be a pain... }-) ]
-
- So, I hereby present 'batchmail', a script to send batched news via
- mail... By the way, I've only used this on our Vax 750 w/news 2.11
- running on 4.3 BSD. My sample use required the following changes to
- get going -
- In the news sys file:
- mts-info-minix:world,comp.os.minix:F:/usr/spool/batch/mts-minix
- In /usr/lib/crontab.local
- 37 3 * * * usenet /usr/new/lib/news/batchmail mts-minix comp.os.minix info-minix@um.cc.umich.edu
-
- Hope it's useful to some other news administrators out there...
-
- ######## Cut here and save #######
- #!/bin/sh
- #
- # batchmail - written to work with news 2.11...
- # Script to read messages batched by news and concatenate them into
- # a digest-format suitable for Internet mailings... Send patches to
- # hyc@umix.cc.umich.edu, or seismo!umix!hyc
- #
- # For each newsgroup to be mailed, add a line of the following format
- # to your sys file:
- # <bogus-host>:<distribution [,distribution...]>, <newsgroup>:F:<batchfile>
- #
- # and a line to crontab (or crontab.local...) like:
- # <time> usenet /usr/new/lib/news/batchmail <batchfile> <newsgroup> <mail-destination>
- #
- batchdir=/usr/spool/batch/
- batchfile=${batchdir}$1
- if test -s $batchfile
- then
- flist=`cat $batchfile`
- rm -f $batchfile
- h=/tmp/mtshead.$$
- n=/tmp/mtsnews.$$
- echo " " > $h
- echo "Today's Subjects:" >> $h
- for i in $flist
- do
- fgrep '^Subject:' $i | sed -e 's/^Subject: / /' >> $h
- echo '-=-=-=-=-=-=-=-=-=-=-=-' >> $n
- cat $i | sed >> $n \
- -e '/^Path: / d' \
- -e '/^Newsgroups: / d' \
- -e '/^Message-ID: /d' \
- -e '/^Sender: /d' \
- -e '/^Keywords: /d' \
- -e '/^References: /d' \
- -e '/^Xref: /d' \
- -e '/^Lines: /d'
- done
- cat $h $n | /usr/ucb/mail -s "Digest of $2" $3
- # cat $h $n ; echo "Digest of $2" $3
- rm -f $h $n
- fi
- --
- -- Howard Chu
- UUCP: ...!seismo!umix!hyc
- ARPA: hyc@umix.cc.umich.edu
-