Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!van-bc!ubc-cs!alberta!myrias!edm!geoff From: geoff@edm.uucp (Geoff Coleman) Newsgroups: comp.unix.questions Subject: Re: SEX! or, how do I mail to a lot of unix users? Message-ID: <1990Jun6.202659.12318@edm.uucp> Date: 6 Jun 90 20:26:59 GMT References: <804@ehviea.ine.philips.nl> Organization: Unexsys Systems inc. Lines: 52 From article <804@ehviea.ine.philips.nl>, by leo@ehviea.ine.philips.nl (Leo de Wit): -> In article <1990May31.230138.14896@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: -> |In article , jason@cs (Jason C Austin) writes: -> || #!/bin/sh -> || -> || users=`cat user-list` -> -> 1 fork, 1 exec. -> -> || -> || for user in $users -> || do -> || echo "Mailing $user" -> || mail $user < message -> || done -> | -> -> 2 forks & 2 execs for each user. -> -> | -> |Too many processes. If you want progress reporting, say: -> | -> |while read user -> |do -> | echo "Mailing $user" -> | mail $user |done | -> -> 1 fork for the redirected while, 2 forks & 2 execs for each user. -> -> Number of processes is the same (but you save an exec). -> Alternative: -> -> set -x # Let the shell do the progress report. -> for user in `cat user-list`; do mail $user -> (1 fork & 1 exec for cat, 1 fork & 1 exec for each user). -> -> Of course, for builtin echo's, not-forked redirected while loops the -> situation differs. -> -> Leo. And lets hope you don't work at an place where the password file has a few thousand entries. This will start up a ridiculous number of processes and bring the machine to its knees. This was a torture test we used to do to machines to see how they really performed. Geoff Coleman