home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!ukma!widener!netnews.upenn.edu!eniac.seas.upenn.edu!chip
- From: chip@eniac.seas.upenn.edu (Charles H. Buchholtz)
- Newsgroups: comp.unix.admin
- Subject: Re: Help Needed: How to send mail to "everybody" at once
- Message-ID: <84194@netnews.upenn.edu>
- Date: 23 Jul 92 13:33:59 GMT
- References: <1992Jul17.140319.23953@sdc.com> <4473@teslab.lab.oz.au>
- Sender: news@netnews.upenn.edu
- Organization: University of Pennsylvania
- Lines: 69
- Nntp-Posting-Host: eniac.seas.upenn.edu
-
-
- kenk@sdc.com (Ken Konecki) writes:
- > mail `awk -F: '{ print $1 }' /etc/passwd`
-
-
- andrew@teslab.lab.oz.au (Andrew Phillips) writes:
- >To just send to normal users (which is I think what was asked)
- >
- >mail `awk -F: '$3>199 && $3<10000 {print $1}' /etc/passwd`
- >
- >(The specific numbers may vary on some systems but on ours normal
- >user numbers start at 200.)
-
- On my system (Sun 4/690, SunOS 4.1.2, wc -l /etc/passwd => 2500), this
- will give "too many arguments". Also, on my system this approach will
- drive the load average through the roof and make the system unusably
- slow. Mail simply starts sendmail working on the message and returns
- immediately, so you'll have hundreds (if not thousands) of sendmail
- processes all competeing for the same system resources dumped onto
- your system.
-
- If you set "sendwait" before calling mail, mail will wait until
- sendmail finishes before returning, so that you will only have one
- sendmail process running at a time.
-
- I remind my users that *news* is designed to send the same message to
- many people - only one copy is saved per site, and minimal storing and
- forwarding is done. Mail is very inefficient when sending the same
- message to many people, because each person gets their own copy,
- separately stored and processed.
-
- However, there are times when you realy do want to send the same
- message as mail to many people. In that situation, I use the
- following script:
-
- ----------------------------------------------------------------------
- #!/bin/sh
- # usage:
- # bulkmail message list 'This is the Subject'
- #
- # "message" is the name of the file that contains the body of the
- # message.
- #
- # "list" is the name of a file which contains the addresses, one per
- # line
- #
- # The third argument is the subject. The subject should be put in
- # quotes so that it is all one argument. You may have to escape some
- # special characters.
-
- if [ $# != 3 ]
- then
- echo usage: bulkmail message list \'This is the subject\'
- exit 1
- fi
-
- sendwait=true
- export sendwait
-
- while read address
- do
- /usr/ucb/mail -s "$3" $address < $1
- done < $2
- ----------------------------------------------------------------------
-
-
- Charles H. Buchholtz Systems Programmer chip@seas.upenn.edu
- School of Engineering and Applied Science
- University of Pennsylvania
-