On Wed, 20 Sep 2000, Chris Reeves wrote:
Linux News User wrote:
Does any one have a script to send an email to all the users on a server ?
There's probably an easier way to do this, but I just knocked up a short perl script that takes the /etc/passwd file and extracts all of the user names from it. This won't work on some boxes, e.g. when the user lists are distributed via NIS/YP, but should work most of the time. [...SNIP...] It would be easy to alter the script so that the users are output to standard out, so you can just call the script from the /etc/aliases file with a line like: everyone: "|/path/to/script" However, if you use it like this, you can't edit the list and the mails will be sent to root, dummy users, etc.
If the script is modified, it can work without editing the output. Usually all the 'ordinary' users all have UIDs above a certain number. Even if this is not the case, it can work if you make a list of usernames that should not be included. Just do: getnames | grep -v '(root|nobody|mail|adabas)' where the grepped names are blocked. BTW, I think you forgot the script Chris. Regards Ole -- Windows: Where do you want to go today? MacOS: Where do you want to be tomorrow? Linux: Are you coming or what? -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq