#!/bin/sh

# $1 = arg 1
# $2 = arg 2
# $3 = num jobs

# Condor submit file
cat > subfile <<EOF

#Universe       = vanilla
Universe       = grid
Grid_resource  = gt2 ce01.cmsaf.mit.edu/jobmanager-condor
#Universe       = Vanilla

# Update this for the path of your current proxy
# You can find it by doing voms-proxy-info
x509userproxy = /tmp/x509up_u1624

# files will be copied back to this dir
Initialdir     = run\$(Process)

# run my script
Executable     = myScript.sh
# with 3 arguments: arg1, arg2 and the job number
Arguments      = $1 $2 \$(Process)
# input files. in this case, there are none.
Input          = /dev/null

# log files
Error          = outlog.run\$(Process)
Output         = errlog.run\$(Process)
Log            = CondorLog.run\$(Process)

# get the environment (path, etc.)
Getenv         = True

# prefer to run on fast computers
Rank           = kflops

# only run on 64 bit computers
Requirements   = Arch == "X86_64"

# should write all output & logs to a local directory
# and then transfer it back to Initialdir on completion
should_transfer_files   = YES
when_to_transfer_output = ON_EXIT

# the output files you want to be transfered back to the initial directory, 
# makes sense to tar them all in your job and transfer that way.
transfer_output_files = output.tgz

# specify any extra input files (for example, an orcarc file)
transfer_input_files    = run\$(Process)/input1, run\$(Process)/input2 

Queue $3
EOF

# submit the job
condor_submit subfile