|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
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! |
|
|||
__________________
FreeBSD 6.2 RELEASE Last edited by bgobs; 14th June 2008 at 10:09 PM. |
|
|||
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! |
|
|||
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. |
|
||||
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''. |
|
|||
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 |
|
|||
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! |
|
|||
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 |
Thread Tools | |
Display Modes | |
|
|
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 |