How to set PWD (present working directory) for a Job?
search cancel

How to set PWD (present working directory) for a Job?

book

Article ID: 15340

calendar_today

Updated On:

Products

CA Workload Automation AE - Business Agents (AutoSys) CA Workload Automation AE - Scheduler (AutoSys) Workload Automation Agent

Issue/Introduction

By default the workload automation agent is executing all the jobs from the agent install directory. Is there a way to change the PWD (present working directory) for a Job?

Environment

Release: All Supported Versions
Component: Workload Automation AE (AutoSys Edition):

Cause

To accomplish the task some of the scripts needs to be executed from designated working directories ( is a directory where they are running from).

Resolution

This can be achieved in a couple of ways -

At the Agent level (Impacts all the jobs running on the agent)

The agentparm.txt has the following parameter 

oscomponent.initialworkingdirectory 

Specifies the default initial working directory for all scripts. Options are as follows: 

SCRIPT 

Sets the path to where the script resides. 

USER 

Sets the path to the home directory of the owner of the script. 

USER_CONT_NOT_AVAIL 

Specifies that the script should run even if a home directory for the user is not defined. 

path 

Specifies the path to the directory in which the script should run. 

 

At the Job level (Specific to the job)

The envvars attribute specifies environment variables to define the local environment where the script, command, or batch file runs. You can modify existing environment variables or create your own.

envvars: PWD=/usr/scripts/dailyrun

 

Additional Information

Agent documentation

https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/workload-automation-system-agent/12-0/reference/ca-wa-agent-for-unix-linux-windows-or-iseries-agent-parameters.html

Scheduler documentation

Autosys Workload Automation

https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/autosys-workload-automation/12-0-01/reference/ae-job-information-language/jil-job-definitions/envvars-attribute-specify-a-job-s-environment-variables.html

ESP Workload Automation

https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/reference/statements/envar-statement-pass-environment-variables.html

ESP dSeries Workload Automation

https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/ca-workload-automation-de/12-3/scheduling/job-types/system-jobs/unix-jobs/environment-variables-in-unix.html