[gridengine users] Modifying headers in email sent by SGE

Gowtham sgowtham at mtu.edu
Wed Jun 15 20:51:51 UTC 2011


I'll give this a try. Personally, I'd actually prefer a 
non-python version.

Best,
g

--
Gowtham
Advanced Research Support
IT User Services, Michigan Tech


On Wed, 15 Jun 2011, Reuti wrote:

| Am 15.06.2011 um 22:28 schrieb Gowtham:
| 
| > Here it is (located /share/apps/sbin/ - so, it is available 
| > for all compute nodes):
| > 
| > taken from
| > 
| >  http://gridengine.markmail.org/search/?q=sge+mail+header+ben#query:sge%20mail%20header%20ben+page:1+mid:azhmwbsrn62akprk+state:results
| > 
| 
| Sorry, I missed the script. The sender you could also adjust in postfix canonical rules I think or like below in the script itself. Would you mind a non-Python one?
| 
| #!/bin/sh
| (cat; echo; echo; echo "Please do not reply to this email") | mail -s "$2" "$3" -- -f "SGE Admin <DoNotReply at mtu.edu>"
| 
| -- Reuti
| 
| 
| > *********************************************************
| > #! /usr/bin/python
| > 
| > # mail_wrapper.py
| > 
| > from optparse import OptionParser
| > from email.MIMEText import MIMEText
| > import subprocess
| > import sys
| > import os
| > import re
| > 
| > # Parse options
| > parser = OptionParser()
| > parser.add_option("-s", dest="subject", default='SGE job 
| > notification')
| > opts, recips = parser.parse_args()
| > 
| > # Set email from and to, including any necessary 
| > substitutions
| > email_re = re.compile("@\w+\.cluster\.ourdomain$")
| > mailto   = [email_re.sub("@ourmailhost.ourdomain", x) for x 
| > in recips]
| > mailfrom = 'SGE admin <sge-admin at ourdomain>'
| > 
| > # Create email text
| > msg            = MIMEText(sys.stdin.read())
| > msg['Subject'] = opts.subject
| > msg['From']    = mailfrom
| > msg['To']      = ", ".join(mailto)
| > 
| > # Send email via sendmail binary
| > p = subprocess.Popen(['/usr/sbin/sendmail', '-oi'] + mailto, 
| > stdin=subprocess.PIPE)
| > p.stdin.write(msg.as_string())
| > p.stdin.close()
| > sys.exit(p.wait())
| > *********************************************************
| > 
| > Then did 
| > 
| >  qconf -mconf
| > 
| > and changed 
| > 
| >  mailer   /bin/mail
| > 
| > to
| > 
| >  mailer  /share/apps/sbin/mail_wrapper.py
| > 
| > 
| > Best,
| > g
| > 
| > --
| > Gowtham
| > Advanced Research Support
| > IT User Services, Michigan Tech
| > 
| > 
| > On Wed, 15 Jun 2011, Reuti wrote:
| > 
| > | What does you wrapper script look like, can you post it?
| > | 
| > | -- Reuti
| > | 
| > | 
| > | Am 15.06.2011 um 22:20 schrieb Gowtham:
| > | 
| > | > 
| > | > Could you please elaborate on your question? I don't quite 
| > | > understand it.
| > | > 
| > | > Best,
| > | > g
| > | > 
| > | > --
| > | > Gowtham
| > | > Advanced Research Support
| > | > IT User Services, Michigan Tech
| > | > 
| > | > 
| > | > On Wed, 15 Jun 2011, Reuti wrote:
| > | > 
| > | > | Hi,
| > | > | 
| > | > | Am 15.06.2011 um 22:01 schrieb Gowtham:
| > | > | 
| > | > | > We are using Rocks 5.4 (with CentOS 5.5) and have
| > | > | > SGE 6.2u5 as queing system. For informative (and to an extent, decorative) purposes, we would like to modify
| > | > | > the headers of emails sent out by SGE.
| > | > | > 
| > | > | > I have checked the mailing list and tried the approach
| > | > | > given in
| > | > | > 
| > | > | >  http://gridengine.markmail.org/search/?q=sge+mail+header+ben#query:sge%20mail%20header%20ben+page:1+mid:g3ovaeqfpyqmmyqt+state:results
| > | > | > 
| > | > | > but it didn't seem to do the trick.
| > | > | 
| > | > | what did you supply in detail as script - it's available (accessible) on all nodes?
| > | > | 
| > | > | -- Reuti
| > | > | 
| > | > | 
| > | > | > 
| > | > | > ************* What it is now *************
| > | > | > 
| > | > | > Date: Wed, 15 Jun 2011 15:42:55 -0400 (EDT)
| > | > | > From: root <root at local>
| > | > | > To: john at mtu.edu
| > | > | > Subject: Job 36 (hello_world.sh) Complete
| > | > | > 
| > | > | > Job 36 (hello_world.sh) Complete
| > | > | > User             = john
| > | > | > Queue            = all.q at compute-0-1.local
| > | > | > Host             = compute-0-1.local
| > | > | > Start Time       = 06/15/2011 15:42:54
| > | > | > End Time         = 06/15/2011 15:42:56
| > | > | > User Time        = 00:00:00
| > | > | > System Time      = 00:00:00
| > | > | > Wallclock Time   = 00:00:00
| > | > | > CPU              = 00:00:00
| > | > | > Max vmem         = NA
| > | > | > Exit Status      = 0
| > | > | > 
| > | > | > 
| > | > | > ************* What we would like to see *************
| > | > | > 
| > | > | > Date: Wed, 15 Jun 2011 15:42:55 -0400 (EDT)
| > | > | > From: SGE Admin <DoNotReply at mtu.edu>
| > | > | > To: john at mtu.edu
| > | > | > Subject: pauli.csa - Job 36 (hello_world.sh) Complete
| > | > | > 
| > | > | > Job 36 (hello_world.sh) Complete
| > | > | > User             = john
| > | > | > Queue            = all.q at compute-0-1.local
| > | > | > Host             = compute-0-1.local
| > | > | > Start Time       = 06/15/2011 15:42:54
| > | > | > End Time         = 06/15/2011 15:42:56
| > | > | > User Time        = 00:00:00
| > | > | > System Time      = 00:00:00
| > | > | > Wallclock Time   = 00:00:00
| > | > | > CPU              = 00:00:00
| > | > | > Max vmem         = NA
| > | > | > Exit Status      = 0
| > | > | > 
| > | > | > 
| > | > | > Please do not reply to this email.
| > | > | > 
| > | > | > *****************************************************
| > | > | > 
| > | > | > 
| > | > | > If you could share any other trick or script or wrapper that will accomplish this, it'd be awesome.
| > | > | > 
| > | > | > Best regards,
| > | > | > g
| > | > | > 
| > | > | > --
| > | > | > Gowtham
| > | > | > Advanced IT Research Support
| > | > | > Michigan Technological University
| > | > | > _______________________________________________
| > | > | > users mailing list
| > | > | > users at gridengine.org
| > | > | > https://gridengine.org/mailman/listinfo/users
| > | > | 
| > | > | 
| > | 
| > | 
| 
| 



More information about the users mailing list