How to adjust the job's environment for the execute machine

Known to work with HTCondor version: 7.0

If you simply need to insert an environment variable, you can do that by putting the following in your configuration file on the execute machine:


If you need to dynamically modify an environment variable, you can do that in a wrapper script around the job. Here is what you would put in the configuration file:


Then you would create a file named condor_job_wrapper (or whatever name you choose), make it executable, and put in something like the following:


# insert /s/std/bin into the PATH
export PATH=/s/std/bin:$PATH

exec "$@"

Another way for information from the machine to enter the job environment is to publish the information in the machine ClassAd and leave it up to the user to insert it into the job's environment via the $$() mechanism, which substitutes in values from the target ClassAd. Example machine configuration:

APP1_PATH = "/opt/app1"
APP2_PATH = "/opt/app2"

Then the user can insert this information into the job environment by putting the following in the job submit file:

environment = "APP1_PATH=$$(APP1_PATH) APP2_PATH=$$(APP2_PATH)"

If it is expected that the job may run on machines where these attributes of the machine ClassAd are not defined, a default value should be specified like this. For example, if it should just be empty when undefined, use this: