I'm not sure if daemon is the correct term but we have a number of processes (ksh scripts) that we start with the "at" command on AIX. Hopefully they run until they are told to shutdown down, at which point the ksh script does an "exit" which somehow causes the process to send a mail message to the process owner's account. When a fatal error kills the process, we also get a mail message. It's great to have a mail sent when the process dies because of some error (for the debugging info it provides), but when a normal shutdown occurs, I'd prefer that no mail message be sent. Is that possible?


If the output on error is printed to stderr, and all of the output in case of normal exit to stdout you can redirect the output when you start the command with at.

at command > /dev/null

By default at emails both stdout and stderr (from the man page):

The user will be mailed standard error and standard output from his commands, if any. Mail will be sent using the command /usr/sbin/sendmail.

The problem is that you will loose the stdout also when you exit with an error. I have for these kind of things a small Python program that wraps another command and caches the output (both stdout and stderr), this cached data is only sent if the exit value of the command is non-zero (or if some special error strings was present in the output, which was handy for some Windows linker I used that always exited with 0, although there were errors.).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.