[GE users] Putting e-mail address in a variable inside script

olesen Mark.Olesen at emconTechnologies.com
Tue May 26 12:49:47 BST 2009

> We are using SGE 6.1 right now, so that feature is not included in it.
> We may upgrade the version, but not yet.
> Any other ideas or suggestions?

At our site, all of our job scripts are generated and submitted via a Perl wrapper. This approach makes it fairly easy to add arbitrary substitutions to the job script.

Reduced to the essentials, the Perl scripts have the following:

# 1. Precalculate things and other stuff ...

# 2.
# define content for shell script - see __DATA__
my %var = map { $_ => $config{$_} } grep { /^[_A-Z]+$/ } keys %config;

# 2b.
# To make something like this work for your case, you'd need
# something like logic as well:

# 3.
# build shell script -  simple substitutions
my $template = do { local $/; <DATA> };
( my $shell = $template ) =~ s/%{\s*([_A-Z]+)\s*}/ $var{$1} || '' /eg;

# 4.
# submit to qsub
    local *STDOUT;
    open STDOUT, "|-", @qsub or warn "cannot open command\n";
    $|++;                     # unbuffered
    print $shell;

# ------------------------------------------ end-of-perl
# This is part of the Perl script, but is treated as a
# data file
# <gridengine>
# =======================
# standard start options, standardized job-name/output
#$ -S /bin/sh -cwd -j y -N %{JOBCLASS} -o %{JOBCLASS}.o$JOB_ID
# Example with dynamically substituted email
# =======================
# </gridengine>
# <environ>

# possibly override env variables:

echo "hello World


I hope this helps give you some ideas.


This e-mail message and any attachments may contain 
legally privileged, confidential or proprietary Information, 
or information otherwise protected by law of EMCON 
Technologies, its affiliates, or third parties. This notice 
serves as marking of its "Confidential" status as defined 
in any confidentiality agreements concerning the sender 
and recipient. If you are not the intended recipient(s), 
or the employee or agent responsible for delivery of this 
message to the intended recipient(s), you are hereby 
notified that any dissemination, distribution or copying 
of this e-mail message is strictly prohibited. 
If you have received this message in error, please 
immediately notify the sender and delete this e-mail 
message from your computer.


To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].

More information about the gridengine-users mailing list