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
- In the EFT Server administration interface, click the Advanced Workflows node.
- In the right pane, click New. The Create a Workflow dialog box appears.
- Provide a name and a description (optional) for the Workflow, then click OK. The Advanced Workflow Task Builder appears.
- 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.
- On the General tab, name the variable ProcessPID.
- On the Advanced tab, select the Variable is private check box.
- Click OK to save the step.
- 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.
- In the Location of script box, click Script is embedded in task file, then click Edit Script. The BASIC Script IDE appears.
- In the text area, type or paste the following text (Sub Main and End Sub are added automatically):
Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Sub Main
ProcessPID = GetCurrentProcessId()
End Sub
- Close the BASIC Script IDE and click Save.
- Click OK to save the step.
- 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.
- 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.
- In the Encoding box, click ANSI.
- 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.
For example: %Now()%, %GetTaskName()%, PID:%ProcessPID%
- Click OK to save the step.
- 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: