[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Emailing every user / site admin on the server...
- Subject: Re: [cobalt-users] Emailing every user / site admin on the server...
- From: "Steve Werby" <steve-lists@xxxxxxxxxxxx>
- Date: Wed Apr 25 23:05:31 2001
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
"Sven" <sven@xxxxxxxxxxxxx> wrote:
> Emailing every user / site admin on the server...
> Is this possible???
Yes.
> Without a script that is..
My method uses a script, but after you run it the first time you only need
to run it if new users are added *and* you can send emails using any method
you prefer (you don't need to send them from a script). I run it from a
cron job every night.
1. Add the following lin to the bottom of /etc/aliases (the email address
can be any address on your server, don't make it easy for your users to
guess if you don't want them to use it).
serverusers@xxxxxxxxxx :include:/root/user_list.txt
2. Run this script.
#!/bin/sh
######################################################################
# generate_user_list.sh
#
# Author: Steve Werby <steve at(@) befriend dot(.) com>
# Created: 2000-05-03 11:25
# Revised: 2000-05-04 09:30
#
# Purpose: Generates a list of all users on the server.
# Output file is used in Sendmail alias file.
#
# Latest version always available at http://www.befriend.com/.
######################################################################
## Installation:
## chmod 0100 generate_user_list.sh
## chown root:root generate_user_list.sh
## Generate user list.
output_file="/root/user_list.txt"
if test -e $output_file
then
rm $output_file
fi
for user in `cut -f1 -d: /etc/passwd`
do
## If want to override environment variable '$HOSTNAME'
## uncomment the following line:
# HOSTNAME="domain.tld"
echo $user@$HOSTNAME >> $output_file
done
## Regenerate aliases database.
newaliases
## Restart sendmail.
sendmail_pid=`head -1 /var/run/sendmail.pid`
kill -HUP $sendmail_pid
3. Email serverusers@xxxxxxxxxx in the bcc: field to hide the email address
from the recipients.
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/