Is there a simple way to do so? I have some programs that when they exit and are running from the command line, I want them to print something to STDOUT, otherwise, to STDERR which has been redirected to a logfile, and send email.
I have searched around the monastary and couldnt find anything (perhaps I did it wrong?) that really touched on this subject.