DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th June 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default Send email to all local users

Does anyone know of a qnd (quick-n-dirty, sorry for stealing your acronym scottro) way to send an email to all local users on a FreeBSD system?

It shouldn't matter much but I've replaced Sendmail with Postfix.

My idea was to create an alias in /etc/mail/aliases and list each user I want the mail to go to, but that could become cumbersome even at a few dozen users, let alone hundreds.

Surely I'm missing something here...
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!
Reply With Quote
  #2   (View Single Post)  
Old 14th June 2008
bgobs bgobs is offline
Port Guard
 
Join Date: Jun 2008
Location: Sofia, BG
Posts: 17
Default

man wall : )

i hope this is ok for you...
__________________
FreeBSD 6.2 RELEASE

Last edited by bgobs; 14th June 2008 at 10:09 PM.
Reply With Quote
  #3   (View Single Post)  
Old 14th June 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default

Wall is cool and all, but what if the user isn't logged in? They won't get the message.

I have two ideas that are possible (but not necessarily practical).

I can:
1) Write the "email" directly to each file in /var/mail, which will effectively "email" every local user. However, even though I am "r00t" and system administrator and all, I don't want to feel creepy about "emailing" everyone, and while all I'm doing is appending a few lines to their mail files, it still doesn't seem responsible of me.

2) I can write a script to run via cron every so often that pulls a list from the passwd file and separates out only the necessary users (all users will have a range of valid UID's), and append that list to an alias in /etc/mail/aliases, then run postalias to update the aliases db.

I was really hoping there was some dark secret that I didn't know of, like "local@domain.tld" would deliver to all local users on the system.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!
Reply With Quote
  #4   (View Single Post)  
Old 14th June 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default

Hmm... looking at aliases(5), it looks like I can do :include: /path/to/file. So it looks like I'll be pulling usernames out of the passwd file, sending them to another file that is ":include:"ed, and run postalias / postfix reload every so often via cron.

Problem solved. Unless anyone else can come up with anything better.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!

Last edited by cajunman4life; 14th June 2008 at 10:55 PM.
Reply With Quote
  #5   (View Single Post)  
Old 14th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Skipping updating the aliases altogether and using a script to do it manually use the pw file + aliases file to send out the e-mails to each user via mail. So that the SMTP server doesn't need a poke nore the over head of file I/O to update the :included:'ed file?
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #6   (View Single Post)  
Old 15th June 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default

Quote:
Originally Posted by cajunman4life View Post
.... and run postalias / postfix reload every so often via cron.
I seriously doubt you need to do a postfix reload. With sendmail there is no need to.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #7   (View Single Post)  
Old 15th June 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Default

Quote:
Originally Posted by J65nko View Post
I seriously doubt you need to do a postfix reload. With sendmail there is no need to.
You're right, I don't think I do... but everything I read says to. Either way.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!
Reply With Quote
  #8   (View Single Post)  
Old 15th June 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default

It is quite simple to test whether the reload command is needed. I just did that test not long ago with my local sendmail
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #9   (View Single Post)  
Old 15th June 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

Doing reload isn't like stopping and starting it. It just makes postfix reread its configuration file with no effect, (at least that I've ever noticed) on mail delivery.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email and SASL JMJ_coder General software and network 3 8th February 2009 05:09 AM
local dns (dnsmasq) bsdperson FreeBSD Ports and Packages 3 3rd September 2008 06:48 AM
send files to email milo974 OpenBSD General 7 1st September 2008 02:03 PM
proxy : replace gif with local gif milo974 OpenBSD General 4 17th July 2008 06:45 AM
Using mail(1) and send-pr(1) from dial-up and private address machines. robbak Guides 0 1st May 2008 07:02 AM


All times are GMT. The time now is 03:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick