home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / admin / 4285 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  2.7 KB

  1. Path: sparky!uunet!gatech!ukma!widener!netnews.upenn.edu!eniac.seas.upenn.edu!chip
  2. From: chip@eniac.seas.upenn.edu (Charles H. Buchholtz)
  3. Newsgroups: comp.unix.admin
  4. Subject: Re: Help Needed: How to send mail to "everybody" at once
  5. Message-ID: <84194@netnews.upenn.edu>
  6. Date: 23 Jul 92 13:33:59 GMT
  7. References: <1992Jul17.140319.23953@sdc.com> <4473@teslab.lab.oz.au>
  8. Sender: news@netnews.upenn.edu
  9. Organization: University of Pennsylvania
  10. Lines: 69
  11. Nntp-Posting-Host: eniac.seas.upenn.edu
  12.  
  13.  
  14. kenk@sdc.com (Ken Konecki) writes:
  15. > mail `awk -F: '{ print $1 }' /etc/passwd`
  16.  
  17.  
  18. andrew@teslab.lab.oz.au (Andrew Phillips) writes:
  19. >To just send to normal users (which is I think what was asked)
  20. >
  21. >mail `awk -F: '$3>199 && $3<10000 {print $1}' /etc/passwd`
  22. >
  23. >(The specific numbers may vary on some systems but on ours normal
  24. >user numbers start at 200.)
  25.  
  26. On my system (Sun 4/690, SunOS 4.1.2, wc -l /etc/passwd => 2500), this
  27. will give "too many arguments".  Also, on my system this approach will
  28. drive the load average through the roof and make the system unusably
  29. slow.  Mail simply starts sendmail working on the message and returns
  30. immediately, so you'll have hundreds (if not thousands) of sendmail
  31. processes all competeing for the same system resources dumped onto
  32. your system.
  33.  
  34. If you set "sendwait" before calling mail, mail will wait until
  35. sendmail finishes before returning, so that you will only have one
  36. sendmail process running at a time.
  37.  
  38. I remind my users that *news* is designed to send the same message to
  39. many people - only one copy is saved per site, and minimal storing and
  40. forwarding is done.  Mail is very inefficient when sending the same
  41. message to many people, because each person gets their own copy,
  42. separately stored and processed.
  43.  
  44. However, there are times when you realy do want to send the same
  45. message as mail to many people.  In that situation, I use the
  46. following script:
  47.  
  48. ----------------------------------------------------------------------
  49. #!/bin/sh
  50. # usage:
  51. #    bulkmail message list 'This is the Subject'
  52. #
  53. # "message" is the name of the file that contains the body of the
  54. # message.
  55. #
  56. # "list" is the name of a file which contains the addresses, one per
  57. # line
  58. #
  59. # The third argument is the subject.  The subject should be put in
  60. # quotes so that it is all one argument.  You may have to escape some
  61. # special characters.
  62.  
  63. if [ $# != 3 ]
  64. then
  65.     echo usage:  bulkmail message list \'This is the subject\'
  66.     exit 1
  67. fi
  68.  
  69. sendwait=true
  70. export sendwait
  71.  
  72. while read address
  73. do
  74.     /usr/ucb/mail -s "$3" $address < $1
  75. done < $2
  76. ----------------------------------------------------------------------
  77.  
  78.  
  79. Charles H. Buchholtz       Systems Programmer     chip@seas.upenn.edu
  80.           School of Engineering and Applied Science
  81.               University of Pennsylvania
  82.