[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[HTCondor-users] Tip: Mailing from jobs



Users will sometimes want to send e-mail of certain outputs from within a running job.

I assisted a user today who was trying to accomplish that, but finding that while his script's e-mail worked fine from the command line, it was not working when run as an HTCondor local-universe job. 

The issue is that when the job exits, any associated processes started by the job are terminated by HTCondor, which includes the asynchronous mail transfer agent (MTA) which is launched by the "/usr/bin/mail" command to perform the mail delivery. This means that if calling "/usr/bin/mail" is the last step before the job exits, the MTA will be terminated before it has a chance to finish delivering the mail.

The solution is to turn on the "sendwait" option. This causes the mail command to wait until the MTA finishes before exiting the mail command:

export sendwait=1
/usr/bin/mail -s "Mail Subject" mailto:user@xxxxxxxxxx < mailfile.txt
exit

This will keep HTCondor from killing the MTA early, since the job won't exit until it's done, and the e-mail will get through.

Michael V. Pelletier
Digital Technology
HPC Support Team
Raytheon Missiles and Defense