Creating a WFL Job to Execute an SSH Command

You can create batch files using WFL to invoke SYSTEM/SSHCLIENT, and execute remote commands.

A WFL job invokes SYSTEM/SSHCLIENT and waits until the SSH command completes successfully or the system displays an error. You can determine the final result from the returned value of the TASKVALUE task attribute. The following table provides the values and their result.

Table 83. TASKVALUE task attribute

If the value is

The result is

0

Completed successfully

4

SSHCLIENTSUPPORT is down

9

Completed with errors


Example

BEGIN JOB SSHCLIENT;
STRING S1;
REAL RESULT;
TASK T1;
S1 := "SSH  ""-l bob -P password -p 22 "" ";
S1 := S1 & " 123.45.678.90 ""uname"" ";
RUN SYSTEM/SSHCLIENT (S1 REFERENCE) [T1]; 
WAIT(T1);
IF T1 (TASKVALUE) = 0 THEN
DISPLAY ("SSH REQUEST COMPLETED OK.")
ELSE
   DISPLAY ("SSH request failed (task value "& 
          STRING (T1 (TASKVALUE), *) & ")");
END JOB
Note: If this WFL job is started from CANDE, the responses to the remote SSH command created by the WFL job are displayed on the screen of the CANDE terminal that started the WFL job.