Can I capture the process ID (PID) of a running AWE Task to a log file?


THE INFORMATION IN THIS ARTICLE APPLIES TO:

  • EFT Server, version 6.3 and later

QUESTION

Can I capture the process ID (PID) of a running AWE Task to a log file?

ANSWER

When troubleshooting AWE it may become necessary to know the PID of the GSAWE.exe that is executing a specific AWE task. The following AWE code can be added to the beginning of an AWE task.

To capture the PID of running AWE task to a log file

  1. In the EFT Server administration interface, click the Advanced Workflows node.
  2. In the right pane, click New. The Create a Workflow dialog box appears.
  3. Provide a name and a description (optional) for the Workflow, then click OK. The Advanced Workflow Task Builder appears.
  4. In the Available Actions pane, expand the Variables node, then click and drag the Create Variable action to the Steps (right) pane. The Create Variable dialog box appears.
  5. On the General tab, name the variable ProcessPID.
  6. On the Advanced tab, select the Variable is private check box.
  7. Click OK to save the step.
  8. In the Available Actions pane, expand the Advanced node, then click and drag the BASIC Script action to the Steps (right) pane. The BASIC Script dialog box appears.
  9. In the Location of script box, click Script is embedded in task file, then click Edit Script. The BASIC Script IDE appears.
  10. In the text area, type or paste the following text (Sub Main and End Sub are added automatically):
  11. Declare Function GetCurrentProcessId Lib "kernel32" () As Long

    Sub Main

    ProcessPID = GetCurrentProcessId()

    End Sub

     

  12. Close the BASIC Script IDE and click Save.
  13. Click OK to save the step.
  14. In the Available Actions pane, expand the File node, then click and drag the Write to File action to the steps (right) pane. The Write to File dialog box appears.
  15. On the General tab, provide the location in which to save the log file. For example, C:\ProgramData\GlobalSCAPE\EFT Server Enterprise\Logs\PID.log.
  16. In the Encoding box, click ANSI.
  17. In the Data to write box, specify the variables that will be written to the log, such as the date, name of task, and PID.
  18. For example: %Now()%, %GetTaskName()%, PID:%ProcessPID%

  19. Click OK to save the step.
  20. Click Run to verify that it is working. You should get a successful result similar to the following example. (In this example, the code was added to the top of the "Sample - Ping" Workflow.)

If the Workflow does not complete successfully, verify that the variable name in your script matches the variable name you created, and that there are no typos in the BASIC Script IDE or the Write to File action.

PID.log will look similar to the following log: