Updated on 2026-01-21 GMT+08:00

Running Shell Scripts

This action aims to run the Shell scripts in a host in a specified environment.

Configuring Deployment Actions

  1. Create an application by referring to Creating an Application.
  2. On the Deployment Actions page, add this deployment action based on the service scenario.
  3. Configure the action using the parameters described in the table below.

    Table 1 Parameters

    Parameter

    Description

    Action Name

    Custom action name. Enter 1 to 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./()

    Environment

    Deployment object. Select an environment whose resource type is host cluster.

    Running Mode

    Default and Background are available.

    NOTE:
    • Default: The result is printed, but the related service or process cannot be started.
    • Background: The service or process can be started, but the result will not be printed.

    Shell Script Path

    Path of the shell script on the target host.

    Running Parameters

    Before executing the script, set parameters. During script execution, the entered parameter values are loaded and used.

    Action Control

    Whether to enable the settings.

    • Keep running on failure: Continue the task even if this action fails.
    • Execute this action with the sudo permission: Use the sudo permission to deploy this action.

How Do I Use Script Execution Parameters?

  1. Use $1, $2, and similar formats in the shell script to reference parameter. For example, the content of the hello.sh script is shown in the following figure.

    Figure 1 Script content

  2. Separate running parameters with spaces, as shown in the following figure.

    Figure 2 Entering running parameters

  3. Check the result.

    In the script, $1 is replaced with test2, and the test2 directory is created.

    Figure 3 Checking the result

Helpful Links

If you encounter any problem during deployment, see Running Shell Scripts.