next up previous
Next: Converting from numbers to Up: C++/C Previous: Forking Processes

How do I email myself when my program is done?

First create a shell script that sends an email tailored to your needs, e.g.,
#! /usr/local/bin/tcsh -f 
mail paciorek << -end- 
Finished executing MCMC run with output $1 and $2 iterations. 
-end-

Save this file, e.g. as mail.csh, and make sure it is executable using >chmod guo+x mail.csh. Next, in your C++ program, call the script, including the two arguments used by the script
string cmd=source mail.csh ; 
cmd=cmd+output_file+ +num_its; 
system(cmd.c_str());

Note that num_its here would need to be a string, so you would have to convert from an integer to a string for this approach to work.



Chris Paciorek 2012-01-21