1

I am working on a Linux system and I have been able to find solutions in the case where it will send a response for success or failure. But, in my case I need to know which one it is and I am often unable to check the machine itself until much later. So I was hoping that I could send an email from the command line for failure or success, containing information as to which of the two ended the calculations.

I have noted the question, “How can I trigger a notification when a job/process ends?” But, it doesn’t provide this duality condition.

1 Answers1

0

If you are on a linux system, a simple way to do this would be to pipe the output of the job (STDERR + STDOUT) into the standard linux mail program, mailx.

Here is an example of the code to do such a thing, using a SMTP relay:

/path/to/script arg1 arg2 2>&1 | mailx -E -s "SUBJECT" -S smtp=smtp://smtphostname -S from="calculation@servername" my@emailserver.com