Thursday, January 10, 2013

COMMAND TASK



The Command task allows us to specify one or more shell commands in UNIX or DOS commands in Windows to run during the workflow.
For example, we can specify shell commands in the Command task to delete reject files, copy a file, or archive target files.
Ways of using command task:
1. Standalone Command task: We can use a Command task anywhere in the workflow or worklet to run shell commands.
2. Pre- and post-session shell command: We can call a Command task as the pre- or post-session shell command for a Session task. This is done in COMPONENTS TAB of a session. We can run it in Pre-Session Command or Post Session Success Command or Post Session Failure Command. Select the Value and Type option as we did in Email task.
Example: to copy a file sample.txt from D drive to E.
Command: COPY D:\sample.txt E:\ in windows
Steps for creating command task:
  1. In the Task Developer or Workflow Designer, choose Tasks-Create.
  2. Select Command Task for the task type.
  3. Enter a name for the Command task. Click Create. Then click done.
  4. Double-click the Command task. Go to commands tab.
  5. In the Commands tab, click the Add button to add a command.
  6. In the Name field, enter a name for the new command.
  7. In the Command field, click the Edit button to open the Command Editor.
  8. Enter only one command in the Command Editor.
  9. Click OK to close the Command Editor.
  10. Repeat steps 5-9 to add more commands in the task.
  11. Click OK.
Steps to create the workflow using command task:
  1. Create a task using the above steps to copy a file in Task Developer.
  2. Open Workflow Designer. Workflow -> Create -> Give name and click ok.
  3. Start is displayed. Drag session say s_m_Filter_example and command task.
  4. Link Start to Session task and Session to Command Task.
  5. Double click link between Session and Command and give condition in editor as
  6. $S_M_FILTER_EXAMPLE.Status=SUCCEEDED
  7. Workflow-> Validate
  8. Repository –> Save

clip_image002


No comments:

Post a Comment

Thank you :
- kareem