Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2000 12:14:01 +0300
From:      Odhiambo Washington <wash@iconnect.co.ke>
To:        freebsd-questions@freebsd.org
Cc:        rmasse@mastery.ca
Subject:   Re: email local users
Message-ID:  <20001213121401.A18071@poeza.iconnect.co.ke>
In-Reply-To: <005b01c064c3$4933b660$0600a8c0@Home>; from "Ryan Masse" on Wed, Dec 13, 2000 at 12:11:23AM -0500
References:  <005b01c064c3$4933b660$0600a8c0@Home>

next in thread | previous in thread | raw e-mail | index | archive | help
* Ryan Masse <rmasse@mastery.ca> [20001213 10:54]: writing on the subject 'email local users'
=>is it possible with a single process to email every user on the box at once?
=>if so how?

The answer is YES and this is how one user on this list adviced and it worked 
for me.

Follow these steps

su
cd /usr/local/bin
create a file called update-userlist which contains the commands below:
#!/bin/sh
awk -F: '($3>999 && $3<65534) { print $1; }' /etc/passwd >/var/log/user.list

save the file.
chmod +x update-userlist

Edit your aliases file and add the following entry at the bottom:

#alias for mailing ALL users
all.users:                      :include:/var/log/user.list

After saving that do newaliases to update the aliases database

Edit your /etc/crontab file and add the following entry: 
#Update /var/log/user.list every hour 
0	*	*	*	*	root	/usr/local/bin/update.userlist

Then go to /va/log
touch user.list

That should be it. After the cron runs you'll be able to send an e-mail to
all.users@your.domain and it will go to all the users on that system.

HTH


-Wash

--
Odhiambo Washington  Inter-Connect Ltd.,
wash@iconnect.co.ke  5th Flr Furaha Plaza
Tel: 254 11 222604   Nkrumah Rd.,
Fax: 254 11 222636   PO Box 83613 MOMBASA, KE.

Slump, and the world slumps with you. Push, and you push alone. -Laurence 
Peter 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001213121401.A18071>