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. Have a look at the script and change anything that needs changing (file locations), then run it. It should produce a file containing all users of the system, which you can then edit to take out any users you don't want in the list (e.g. root or various dummy users for programs/daemons). Finally, put it in /etc or somewhere safe and add the following line to your /etc/aliases file: everyone: :include:/path/to/generated/file Where 'everyone' is the mail address you use to send an email to all users. Don't forget to run 'newaliases' after altering the aliases file. 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. Hope that helps, Chris -- __ _ -o)/ / (_)__ __ ____ __ Chris Reeves /\\ /__/ / _ \/ // /\ \/ / ICQ# 22219005 _\_v __/_/_//_/\_,_/ /_/\_\ -- 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