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, complete these steps:

  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. See Output redirection.

  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 Hinzufügen eines Programms zu einem 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, a Unix shell script can contain these lines of code:

find / -name core > /tmp/results 2>/tmp/errorsSearch the file system for files named core. Redirect the standard output, the list of files found, to the /tmp/results file. Redirect any error messages to the /tmp/errors file.
df | lp -dpr1050Print the output of the df command, a report of the free disk space, on printer pr1050.
df | mailx -s "Free disk space" jdoe@mycomp.com
Mail a report of the free disk space, with subject "Free disk space", to jdoe@mycomp.com.

 

For details on output redirection, refer to your operating system documentation.