From owner-freebsd-questions Wed Dec 13 1:11:19 2000 From owner-freebsd-questions@FreeBSD.ORG Wed Dec 13 01:11:17 2000 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from siafu.iconnect.co.ke (upagraha.iconnect.co.ke [209.198.248.2]) by hub.freebsd.org (Postfix) with ESMTP id 34E9737B400 for ; Wed, 13 Dec 2000 01:11:14 -0800 (PST) Received: from [64.110.74.50] (helo=poeza.iconnect.co.ke) by siafu.iconnect.co.ke with esmtp (Exim 2.12 #1) id 1467uR-000ACA-00; Wed, 13 Dec 2000 12:09:12 +0300 Received: from wash by poeza.iconnect.co.ke with local (Exim 3.16 #1) id 1467z7-0004j0-00; Wed, 13 Dec 2000 12:14:01 +0300 Date: Wed, 13 Dec 2000 12:14:01 +0300 From: Odhiambo Washington To: freebsd-questions@freebsd.org Cc: rmasse@mastery.ca Subject: Re: email local users Message-ID: <20001213121401.A18071@poeza.iconnect.co.ke> Mail-Followup-To: Odhiambo Washington , freebsd-questions@freebsd.org, rmasse@mastery.ca References: <005b01c064c3$4933b660$0600a8c0@Home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <005b01c064c3$4933b660$0600a8c0@Home>; from "Ryan Masse" on Wed, Dec 13, 2000 at 12:11:23AM -0500 X-Operating-System: FreeBSD poeza.iconnect.co.ke 3.5-STABLE FreeBSD 3.5-STABLE X-Location: Mombasa, KE, East Africa Sender: Odhiambo Washington Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Ryan Masse [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