On-prem command-line scripts
Enterprises often have on-prem applications and databases that are deployed within their corporate datacenter.
On-prem command-line scripts connector allows you to run whitelisted command line scripts in your private network. The command is executed by the on-prem agent. You can whitelist any command that can be run on the machine with the on-prem agent.
Setup and connection
First, follow the instructions to setup an on-prem agent.
Next, find the agent's
config.ymlfile and setup a connection profile for
On-prem command-line scripts. Following the example provided in the documentation provided, we have created a profile called
4) After the agent is active, you will be able to setup Workato's
On-prem files connector. Input the connection profile name and select an On-prem agent, in this case,
On-prem command-line scripts.
5) Click on
Link your account. If everything is setup correctly, you will see a
Connection success message.
Execute command-line script action
The commands listed in the on-prem agent's
config.yml file are the only ones that can be invoked with this connector. The commands are whitelisted when you include them in this file. View how to setup a connection profile here.
The input parameters should be specified when creating your profile in the on-prem agent's
config.yml file. In the example below, two parameters,
source_file were specified. View how to setup a connection profile here.
Input parameters in the agent's config.yml file
Correspondingly, after selecting the command-line script 'Append file to another' in your recipe, the 2 parameters appear in the script input as required values as shown below:
Input parameters in the recipe
In the fields, you should provide data pills or static data that you wish to use in your command-line script.
timeoutparameter is specified in the
config.ymlfile. This property is the maximum duration (in seconds) for each script execution. The value of the timeout parameter defaults to 90 seconds when not provided.
concurrency_limitparameter is specified in the
config.ymlfile. This value states the maximum number of concurrently executed scripts and defaults to 10 when not provided. After reaching the limit, requests will be queued until prior scripts are executed.
Escaping parameter values
To escape parameter values, use an escape character when defining a profile in the on-prem agent's
config.yml file. The escape_char property value is set to '\' on Unix and '""' on Windows.
Using an escape character
In the example shown in the image above, values in the
target_file name can be escaped with a backslash.
Invocation styles (Synchronous/asynchronous)
To invoke the command asynchronously, scroll to the 'Remove optional fields' dropdown and select the field 'Run script in background?'. Running the command in the background allows the rest of the recipe steps to continue without waiting for the command to complete (asynchronous).
Leave the option blank or select 'No' and the command will run in the foreground (synchronous). The recipe will wait for the command to complete its run before proceeding to the subsequent steps.
The output of the execute command-line script includes:
An ID that is unique to the command-line script that was run.
Every command returns an exit code. A successful command returns a 0, while an unsuccessful one returns a non-zero value that is the error code.
System out shows the message that is returned after the command-line script has run. The message is restricted by a 50k character limit.