CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Email notification after finished solver (

sega March 2, 2009 05:54

Do you think it's possible to
Do you think it's possible to get an email notification after a solver finished running?

I'm using OpenFOAM on an university machine I'm accessing with Putty.
Getting a notification would be very nice, so I don't have to check all the time if the solver is still running.

I tried to use some command-line tools for sending emails, but didn't manage to use one properly, not to mention including them in the code of the solver.

Thanks so far.
Have an nice day.

olesen March 2, 2009 06:04

This is normally the task of t
This is normally the task of the queuing system (ask the sysadmin). If you running without a queuing system, you could try calling /bin/mail or equivalent via the systemCall functionObject. If that doesn't do it, you could just hack in the equivalent system call after the final solver loop.
In any case, you'll need to get your mailer script working first.

sega March 2, 2009 06:14

Well, I don't understand half
Well, I don't understand half of what I pretend to.
Getting the mailer script (this is the tool responsible for sending the mail?) to work properly is probably platform dependet?
Or is there a standard-solution for such a problem?

BTW. What is a queuing system?

olesen March 2, 2009 06:32

> Mailing: The backend for
> Mailing:

The backend for mailing is normally sendmail or postfix on Unix-type machines, but I wouldn't generally advise descending to that level. Instead it is easier to use /bin/mail, /usr/bin/mail, /usr/ucb/mail - the exact path depends on which OS you are using. On some systems you might need to use Mail or mailx.
Read the appropriate manpage and you'll see that they all use -s "some subject" followed by the mail address. The body of the message is taken from stdin. ASSUMING the mailer is correctly set up on the machine, you'll either get the email directly or you can set the email address in the ~/.forward file.

You can simply wrap the call to the appropriate mailer within a shell script (eg, foamMail might be a nice name) and generate your message on-thy-fly (eg, report the time/date and PWD of the job that finished) any pipe it thru to the mailer.

> Queuing system:
eg, GridEngine, PBS, OpenPBS, LSF, LoadLeveller.

chegdan April 6, 2009 18:35

python script to send mail
1 Attachment(s)
I'm not sure if you resolved this, but I was able to find a really simple python script to send mail. I think this would be easy. here is the python script.

All times are GMT -4. The time now is 23:59.