SSH/SFTP Plugin - Commands


‘execute’ ‘query.shell’ on ‘ssh’

What ?

It allows to execute a command line over SSH.

EXECUTE execute WITH {query<Res:query.shell>} ON {<Tar:ssh.target>} AS {result<Res:Result.shell>} [ USING $(timeout : <n>) ]

> Input :

  • {query<Res:query.shell>} : The name of the resource referencing a file which includes one or several shell command lines (query.shell type resource).
  • {<Tar:ssh.target>} : The name (in the context) of the SSH server to use (ssh.target type target).
  • <n> : An integer that represents time in milliseconds. It’s the time to wait before the command execution times out. It can be defined via an inline instruction : $(timeout : …)

Note : If the timeout property is not defined here, we use the timeout property of query.shell resource (set to 5s by default).

> Output :

  • {result<Res:result.shell>} : The name of the resource which contains the shell commands result (result.shell type resource).

Example :

LOAD shell/shell_command.txt AS command.file

CONVERT command.file TO query.shell USING $(timeout:15000) AS commandLine

EXECUTE execute WITH commandLine ON ssh_server AS result



‘put’ ‘file’ on ‘SFTP’

What ?

This command allows to put a file on a SFTP server.

EXECUTE put WITH {<Res:file>} ON {<Tar:ssh.target>} AS $() USING $(remotepath : <distantPath> )

> Input :

  • {<Res:file>} : The name of the resource which references the file to put on the SFTP server (file type resource).
  • {<Tar:ssh.target>} : The name (in the context) of the SFTP server to use (ssh.target type target).
  • <distantPath> : It corresponds to the file path on the SFTP server, relatively to the home directory.

Remark : If in <distantPath> some directories don’t exist on the server, they are then created.

Example :

LOAD path/toto.xml AS toto

EXECUTE put WITH toto ON SFTP-server USING $(remotepath : toto.xml) AS $()



‘get’ ‘file’ on ‘SFTP’

What ?

This command allows to get a file from a SFTP server.

EXECUTE get WITH $() ON {<Tar:ssh.target>} AS {result<Res:file>} USING $(remotepath : <distantPath> )

> Input :

  • {<Tar:ssh.target>} : The name (in the context) of the SFTP server to use (ssh.target type target).
  • <distantPath> : It corresponds to the file path on the SFTP server, relatively to the home directory of the file you want to get.

> Output :

  • {result<Res:file>} : The name of the resource which references the file you get from the SFTP server (file type resource).

Example :

EXECUTE get WITH $() ON SFTP-server USING $(remotepath :sample.zip) AS zip


‘delete’ ‘file’ on ‘SFTP’

What ?

This command allows to delete a file on a SFTP server.

EXECUTE delete WITH $() ON {<Tar:ssh.target>} AS $() USING $(remotepath : <distantPath> [,failIfDoesNotExist : false])

> Input :

  • {<Tar:ssh.target>} : The name (in the context) of the SFTP server to use (ssh.target type target).
  • <distantPath> : It corresponds to the file path on the SFTP server, relatively to the home directory of the file you want to delete.
  • 'failIfDoesNotExist : false' : It allows to specify to SKF that the test must not fail if the resource we’re trying to delete doesn’t exist.

> Output :

  • {result<Res:file>} : The name of the resource which references the file you get from the SFTP server (file type resource).

Remarks :

  • <distantPath> can indicate a file OR a directory. To represent a directory, the path should end with the character ‘/’.
  • The deletion of a directory is recursive : deletion of all sub-directories and files.
EXECUTE delete WITH $() ON SFTP-server USING $( remotepath : path/to/myfile.txt, failIfDoesNotExist: false) AS $()