Configure a Step to Execute a Local Script

You can configure a user-defined step to execute a script that resides on the instance. The script type and format must comply with all the script type and format restrictions.

For a list of script type and format restrictions, see Limitations and Considerations.

Note

If you want a user-defined local script step to execute on a movable compute instance after it has moved to the standby region:
  1. Configure the user-defined group and the step for the script to execute on the primary compute instance.
  2. Edit the DR plan and reorder the groups to move this user-defined group and step to a location in the DR plan that is after the group where the movable compute instance is launched in the standby region.
Scripts that exit with a non-zero code are considered failed and result in the user-defined step failing execution.
  1. Select the region in which the instance currently resides.
    Note

    When selecting the region for the instance, you must ensure that the instance is currently located in the selected region. Even if the step executes after the instance relocates to another region, the selected region must match the current region of the instance.
  2. Select the option for Run local script.
  3. Select the Target instance. This is the instance on which the script resides and will be executed.
    Note

    If the Target instance is in a private subnet, ensure to set up a NAT Gateway. See Setting Up a NAT Gateway for more information.
  4. Provide the Script parameter for execution. This should be the full path of the script including all parameters required for execution. For example:
    /home/opc/scripts/myscript.sh arg1 arg2 arg3
  5. Optionally, provide a Run as user to execute the script using a user ID that is different from the default user ID ocarun. For example, provide opc as the Run as user to execute the script as the opc user.
    Note

    The Run as user option is not supported on a Windows instance. However, the Run as user option is supported on a Linux instance.
  6. Click Add Step to finish adding the user-defined group and step.