Previous Topic: UNIX JobsNext Topic: Script and Command Name Specifications in a UNIX Job


Define a UNIX Job

You can define a UNIX job to schedule workload to run on a UNIX computer. The job can run a script or execute a command.

Note: To run these jobs, your system requires CA WA Agent for UNIX or Linux.

Follow these steps:

  1. Open the Application that you want to add the job to in the Define perspective.

    The Application appears in the workspace.

  2. Select the UNIX job from the System group in the Palette view, and drag the job to the workspace.

    The UNIX icon appears on the Application workspace view.

  3. Right-click the UNIX icon, and select Edit from the pop-up menu.

    The Basic page of the UNIX dialog opens.

  4. Complete the following required fields:
    Name

    Defines the name of the job that you want to schedule.

    Limits: 128 alphanumeric characters, plus the special characters commercial at (@), pound (#), dollar sign ($), underscore (_), square brackets ([]), brace brackets ({}), and percent sign (%) as a symbolic variable introducer character.

    Agent

    Specifies the name of the agent installed on the UNIX computer or the name of the agent group where the job runs. You can use agent groups for load balancing or to run a job on all agents in a group.

    Note: The drop-down list displays all the agents that are defined in the Topology for the specified job type.

    Specify action to take

    Indicates whether the job runs a script or executes a command.

    Note: You can also browse for the script or command name using the Script/Command Browser, enter the script or command name without the full path, or enter the script or command name using an environment variable.

  5. (Optional) Specify the following additional information:
    Arguments to pass

    Defines the argument string of positional parameters to pass to a script. Arguments can be numeric or alphabetic strings of data.

    Note: You must specify each parameter in the order it is expected in the script, separating each parameter with a blank space. To pass a parameter containing spaces, enclose it in double quotes.

    Examples: p1 p2 p3, 362 "629 630" 748

    User ID

    Specifies the UNIX user ID that has the authority to run the job on the agent computer. You must specify a user ID if the job runs a command. This field supports the use of a namespace for a user that has more than one password. Contact your administrator for the user name defined in the Topology.

    Default: Owner of the script or command (if the agent runs under the root account)

    Examples: Bob, Production:Bob

    Notes:

    • The drop-down list displays all the user IDs that are defined in the Topology for the specified agent. You must have at least Read access to the ADMIN.Network Topology permission to view this list.
    • If the agent runs under another account, the job runs under the same account that runs the agent. The user ID or account must have the authority to run the script or command; otherwise, the job fails.
    Shell

    Indicates the shell name used to execute the script or command file. The default for most agents is the Korn shell (/bin/ksh). However, you can choose one of the following shells:

    • /bin/csh—C shell
    • /bin/bash—Bourne Again shell
    • /bin/ksh—Korn shell
    • /bin/sh—Bourne shell
  6. Click OK.

    The UNIX job is defined.

Example: Run a Script that is Located in a Path Set in the PATH Environment Variable

Suppose that the job PROCSCRIPT runs a script named procscript.sh. The job runs under the user ID jsmith, who has the authority to run the script. The path to procscript.sh is set in the PATH system environment variable for jsmith. This job runs on the default agent computer.

To run a script that is located in a path set in the PATH environment variable

  1. Enter the following information in the Basic page:
  2. Select the Run a script option button.
  3. Click OK.

Example: Run a Script that is Located in a Path Set in a User Environment Variable

Suppose that the job MYSCRIPTJOB runs a script named myscript.sh. The job runs under the user ID jsmith, who has the authority to run the script. The path to myscript.sh is set in the user environment variable $MY_PATH, which is defined in the profile file for jsmith. This job runs on the default agent computer.

To run a script that is located in a path set in a user environment variable

  1. Enter the following information in the Basic page:
  2. Select the Run a script option button.
  3. Click OK.

Example: Run a Different Script Depending on the Agent

Suppose that a job runs a payroll script (/export/home/cybuser/payroll.sh) on the UNIX1 agent. Sometimes, the job runs under a different agent. In this case, the job needs to run another script (export/home/cybuser/other_script.sh).

The %IF statement for the job's Script/command name field is as follows:

%IF(WOB._Agent=='UNIX1','/export/home/cybuser/payroll.sh','/export/home/cybuser/other_script.sh')

The WOB._Agent symbolic variable represents the agent that the job runs on.

Note: For more information about JavaScript expressions and built-in functions, see the Programming Guide.

Example: Run a PERL Script

Suppose that you want to schedule a PERL script located at /home/espuser/esptest/esptest.pl, and the PERL executable is located at /usr/contrib/bin/perl. The job PERLJOB runs under the user jsmith, who has access to the PERL executable and the authority to run the PERL script. This job runs on the default agent computer.

To run a PERL script

  1. Enter the following information in the Basic page:
  2. Select the Execute a command option button.
  3. Click OK.