To add a shell command to a job

You can link a shell command to a job. You can also link a command file (cmd file), or a Visual Basic script.

To add a command or script to a job:

  1. Start the Add Shell Command to Job (ttaad5205m000) session.
  2. Specify this information:

    • The name of the command or script
    • The arguments for the command or script
    • A return value

    See Add Shell Command to Job (ttaad5205m000).

  3. Click Test script.

    The command or script is executed with the specified arguments. If the execution fails, an error message is displayed.

    Typically, to test the command or script, you must redirect its output.

  4. Click Add to Job.

    The Add Session to Job (ttaad5102s000) session starts.

  5. Select the job to which you want to link the command or script and specify the required information.

    See Add Session to Job (ttaad5102s000) and Adding a session to a job.

  6. Click OK.

Output redirection

You must redirect the output of the command or script to a file or printer. Use the operating system's redirection facilities in the code of the command file or script.

In a UNIX shell script, you can use the > and | characters to redirect the output. For example, this table shows the lines of code a UNIX shell script can contain:

Code lines Desscription
find / -name core > /tmp/results 2>/tmp/errors Search the file system for files named core. Redirect the standard output, the list of files found, to this file /tmp/results. Redirect any error messages to this file /tmp/errors.
df | lp -dpr1050 Print the output of the df command, a report of the free disk space, on printer pr1050.
indented-estimateddf | mailx -s "Free disk space"
Mail a report of the free disk space, with subject "Free disk space", to

For details on output redirection, see your operating system documentation.