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:
- Start the Add Shell Command to Job (ttaad5205m000) session.
-
Specify this information:
- The name of the command or script
- The arguments for the command or script
- A return value
See .
-
Click
.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.
-
Click
.The Add Session to Job (ttaad5102s000) session starts.
-
Select the job to which you want to link the command or script and specify the required information.
See and Adding a session to a job.
-
Click
.
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. |
|
Mail a report of the free disk space, with subject "Free disk space", to jdoe@mycomp.com. |
For details on output redirection, see your operating system documentation.