LocalCommandRun

LocalCommandRun

LocalCommandRun allows CDP to invoke any OS command locally on the same controller CDP system is running on.

LocalCommandRun shares common properties with other Requests, but has the following specific configuration properties and elements:

Property / ElementDescription
CommandLine<string>Command line (i.e. command with all parameters) to invoke for each request. CommandLine platform-dependent (Linux or Windows) parts can be hidden from other platform, like this:
  • Parts between tags [LINUX: and :] will only be included when system is run on Linux
  • parts between tags [WINDOWS: and :] will only be included when system is run on Windows

For example, to run 2 commands sequentially using one CommandLine on both platforms you can use CommandLine:

CommandOne [LINUX:;:][WINDOWS:&:] CommandTwo

Note: CommandLine property will be processed by FormatTranslator before invoking, so you can use any request channel value in here, that can be useful for using values as part of CommandLine (note that values can also be ValueMap translated to any string).

UseShell<bool>When set, command is executed via operating system shell (sh in Linux and cmd in Windows). Default is to use shell.
WorkingDirectory<string>Working directory to run the command in. If left empty, CDP application folder is used.
ClearEnvironment<string>When set, all system environment variables are cleared before request is run. Default is not to clear existing variables.

Note: You can set specific Environment variables for the command using Environment elements (see below).

GetResponseFromSpecifies what will be used as request response stream, as input for response translator. Choose between options:
  • StdoutAndStderr - both command standard output (stdout) and standard error (stderr) will be used
  • OnlyStdout - only command standard output (stdout) will be used (i.e. stderr will be filtered out)
  • OnlyStderr - only command standard error (stderr) will be used (i.e. stdout will be filtered out)
  • File - file content will be used as command output (instead of stdout and/or stderr). File name has to be specified by ResponseFile property.
ResponseFile<string>File name to get response body from when GetResponseFrom=File. File name can be either with absolute (full) path or relative to CDP application folder.
Environment elementsUnlimited number of Name and Value pairs that will be set as command environment before each request invoked.

Note: Environment Name and Value properties will be processed by FormatTranslator before setting, so you can use any request channel value in here (can be useful for setting environment variables based on channel values).

LocalCommandRun state can be observed via these read-only properties:

PropertyDescription
LastRunTimeTime stamp of the last command run
LastReturnCodeReturn (exit) code of the last command run

Note: LocalCommandRun will be invoking commands under the same user and privileges as CDP application is run. For security reasons, there is no property or option to escalate privileges for the command.