home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8707 / 69 < prev    next >
Encoding:
Internet Message Format  |  1990-07-13  |  2.7 KB

  1. From: hyc@umix.UUCP (Howard Chu)
  2. Newsgroups: comp.sources.misc
  3. Subject: Batching news for mailing
  4. Message-ID: <3655@ncoast.UUCP>
  5. Date: 28 Jul 87 00:25:20 GMT
  6. Sender: allbery@ncoast.UUCP
  7. Organization: University of Michigan Computing Center, Ann Arbor, MI
  8. Lines: 68
  9. Approved: allbery@ncoast.UUCP
  10. X-Archive: comp.sources.misc/8707/69
  11.  
  12. I was recently faced with the problem of supplying Usenet articles
  13. to hosts without access to uucp or nntp, only mail. I set up a mailing
  14. list to send to, and to keep from having to send zillions of tiny
  15. messages, I set it up using the batching mechanism of news. Anyway,
  16. I wrote up a little script to collect the batched news and mail it out
  17. in the form of an ARPAnet digest, and thought it might be useful enough
  18. to share with the world... [I sure wish the Info-Apple moderator would
  19. do something like this. 50 messages a day from that list is getting to
  20. be a pain...   }-)  ]
  21.  
  22. So, I hereby present 'batchmail', a script to send batched news via
  23. mail... By the way, I've only used this on our Vax 750 w/news 2.11
  24. running on 4.3 BSD. My sample use required the following changes to
  25. get going -
  26.   In the news sys file:
  27. mts-info-minix:world,comp.os.minix:F:/usr/spool/batch/mts-minix
  28.   In /usr/lib/crontab.local
  29. 37 3 * * * usenet /usr/new/lib/news/batchmail mts-minix comp.os.minix info-minix@um.cc.umich.edu
  30.  
  31. Hope it's useful to some other news administrators out there...
  32.  
  33. ######## Cut here and save #######
  34. #!/bin/sh
  35. #
  36. #    batchmail - written to work with news 2.11...
  37. #    Script to read messages batched by news and concatenate them into
  38. #    a digest-format suitable for Internet mailings... Send patches to
  39. #    hyc@umix.cc.umich.edu, or seismo!umix!hyc
  40. #
  41. #    For each newsgroup to be mailed, add a line of the following format
  42. #    to your sys file:
  43. #        <bogus-host>:<distribution [,distribution...]>, <newsgroup>:F:<batchfile>
  44. #
  45. #    and a line to crontab (or crontab.local...) like:
  46. #        <time> usenet /usr/new/lib/news/batchmail <batchfile> <newsgroup> <mail-destination>
  47. #
  48. batchdir=/usr/spool/batch/
  49. batchfile=${batchdir}$1
  50. if test -s $batchfile
  51. then
  52.     flist=`cat $batchfile`
  53.     rm -f $batchfile
  54.     h=/tmp/mtshead.$$
  55.     n=/tmp/mtsnews.$$
  56.     echo " " > $h
  57.     echo "Today's Subjects:" >> $h
  58.     for i in $flist 
  59.     do 
  60.         fgrep '^Subject:' $i | sed -e 's/^Subject: /    /' >> $h
  61.         echo '-=-=-=-=-=-=-=-=-=-=-=-' >> $n
  62.         cat $i | sed >> $n \
  63.             -e '/^Path: / d'    \
  64.             -e '/^Newsgroups: / d'    \
  65.             -e '/^Message-ID: /d'    \
  66.             -e '/^Sender: /d'    \
  67.             -e '/^Keywords: /d'    \
  68.             -e '/^References: /d'    \
  69.             -e '/^Xref: /d'        \
  70.             -e '/^Lines: /d'
  71.     done
  72.     cat $h $n | /usr/ucb/mail -s "Digest of $2" $3
  73. #    cat $h $n ; echo "Digest of $2" $3
  74.     rm -f $h $n
  75. fi
  76. -- 
  77.   -- Howard Chu
  78. UUCP:    ...!seismo!umix!hyc
  79. ARPA:    hyc@umix.cc.umich.edu
  80.