Email alert after termination

I am running the gaussian program on UNIX with bash and I want to form a script that will email me once the output life terminates either "normal termination" or "false" I just started learning this last week so could you let me know how to go about this.:b:

Does your system already have an email server? That will be the bulk of the work if not.

actually I am not sure. I am still learning this so how do I check.

echo "Arrrr" | sendmail "my@email.address"

It doesn't have it so how do I start lol. The only thing I learned so far is simple echo and execute command sequences. I am still going through tutorials. So any tips how to tackle this?

Are you the administrator of this system? If you are, the easiest place to start would be installing and configuring 'ssmtp', an email "server" which is actually an email client and just logs into some other email account.

If you're not the administrator, you're stuck with begging them to install it or hacking up a script which uses whatever email client your system has available.

Instructions for either of these depend on what your system is, what is it?

2 Likes

After I install the email, how do I go about this, should I add the grep "normal termination or "error termination" and then file.log name and which command, should I add time?

I don't understand half your question, and you didn't bother to answer mine, so we are at an impasse.

Sorry I did actually answer but it did not upload my answer from my phone, so what I said is that i will have my administrator install the email. After that how should I proceed with my script.

script | sendmail "email@address"

Beyond that, I will need more detail from you.

If you don't have a computer, you will have great difficulty implementing any of our answers in any case.

I have a computer core i7, all good. So the details are that I am running a long calculation on a program called gaussian on UNIX, when the calculation finishes it either has "normal or error termination" on the output.log file produced. What I want is to automate an alert the minute this is produced.

script
sendmail "email@address" < output.log

that script does not specify, when it sends, what time or if the output has terminated already...

The email gets sent once 'script' terminates because shell scripts run one line at a time.

Emails include a time by definition.

1 Like