Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I be alerted when incoming email generates an error?

Status
Not open for further replies.

cmayo

MIS
Apr 23, 2001
159
US
Not sure what to even ask here... I have a shared Linux hosting account with Lunarpages, not sure what distribution the server runs.

In my cPanel mail config, I'm having all unrouted email for a particular subdomain routed to a PHP script which parses the mail, updates a MySQL database table based on the content of the mail, then forwards the mail to s specific person, again based on the content of the incoming mail.

A recent script update inadvertently unset the execute bit on the PHP mail parsing script, causing the incoming mail to bounce back to the sender with a "no such address" error:

"A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

pipe to
|/path/to/script/parseMailScript.php
generated by ticket_4889_reference@subdomain.domain.com
local delivery failed"

My problem is that the mail-parse PHP script had been throwing these errors for 2 weeks before a client finally notified us that his mails were bouncing...

Can anyone suggest a mechanism where I could be notified if the script I'm piping to throws an error when trying to execute or some other condition prevents the pipe from opening?
 
Write a 'wrapper' script that only runs other scripts, checks the exit codes and writes status to a file. You'll have to make sure your script update routines specifically exempt the wrapper script so the execute bit does not get unset, or locate the wrapper in a non-standard but accessible directory.

Perhaps include in the wrapper Emailing a copy of the status file to yourself, and when one of your clients misses the daily Email you can SSH or VPN in and see whats going on.

Or just do an added item on the update checklist for your clients: Check all privileges after the update? :)

----------------------------------------------------------------
Pat Welch, UBB Computer Services, a WCS Affiliate
SCO Authorized Partner
Microlite BackupEdge Certified Reseller
Unix/Linux/Windows/Hardware Sales/Support
 
That's a nice idea; working on it now. Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top