Function Block FS_EXEC

The Function Block FS_EXEC executes one or more remote commands without a shell.

Warning: System commands can endanger or damage the remote system. In addition, existing files may be overwritten without warning.

The file system must have been initialized beforehand using FS_INIT. All operations are performed asynchronously per configured storage medium.

Input RUN

A positive edge will execute the specified command.

Input DEV

Defines the device from which files should be accessed. The device is used per project and can be managed in the context menu under Project External Storage.

Input PATH

Specifies the path to the directory on the storage medium. The path corresponds to a Unix file path in UTF-8 format, if this is supported. The path is represented as follows:

Folder/Subfolder

Using a path is optional. If it has been set, changing to this directory must be successful; otherwise, the command to be executed will not be carried out.

Input CMD

Defines the command to be executed.

Input PTY

Defines the type of console (Pseudo-Terminal). For some devices, this parameter is mandatory. Examples: "vt100", "vt102", "ansi", "xterm" etc.

Note: If a PTY is used, each command must be terminated with a line end, e.g.: "ls\n". Also note that the console formats the output. Therefore, control characters or binary data may also be included.

Input ENV

Defines the active environment variables. To specify multiple variables, one can be defined per line. Example:

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8

Input SIZE

Defines the size of the terminal. By default, this is specified in characters but can also be defined in pixels. For example: "80x25" or "640x480px". If no value has been defined, "80x25" is used.

Output DONE

The output returns a pulse on success to perform the next operation. The pulse occurs when the process ends, even if an error has occurred.

Output RETURN

Returns the command's return value upon successful execution. The value is stored for later use.

Output RETERR

Returns the command's return value in case of erroneous execution. Also known as STDERR when using SSH. The value is stored for later use.

Output ERROR

In case of an error, returns a text with an error message. This is FALSE if no error has occurred. The state is stored for later use.

Possible causes:

  • The service of the storage medium was not started.
  • The storage was not initialized.
  • The login credentials are invalid.
  • The remote server could not be reached.
  • The storage medium does not exist.
  • The specified path is invalid.
  • Writing to the storage medium is not possible.
  • No more storage space available on the storage or the storage is write-protected.

See Also