Editing the Script for Consistency of LUN Protected Groups

Edit the LUN protected group consistency script by referring to this chapter and the default script.

Linux

  1. Log in to the production application server as a user with the administrator rights and go to the directory where the customized script is stored.
  2. Edit the customized script.

    When editing the customized script, you are advised to run the . "$2/bin/agent_thirdpartyfunc.sh" command to initialize the script to ensure that the variables and functions in the script are available.

    Table 1 and Table Function list show the available variables and functions after the script is initialized.

    Table 1 Variable list

    Name

    Description

    PID

    Unique ID

    AGENTROOT

    Root directory of the eReplication Agent

    BINPATH

    bin directory of the eReplication Agent

    TMPPATH

    Temporary file directory of the eReplication Agent

    LOGPATH

    Log directory of the eReplication Agent

    LOG_FILE_NAME

    Name of a log file

    RSTFILE

    Temporary file that stores the error message returned by the script to the eReplication Agent

    INPUT_PARA_TEMP_FILE

    Temporary file that stores variables

    INPUT_PARAMETER_LIST

    Stores all variables transferred from the eReplication Agent to the script.

    Table 2 Function list

    Name

    Description

    Example

    GetValue

    Obtains the value of input parameter key.

    • Input parameter

      key indicates the name of the variable to be obtained, for example, MysqlUser.

    • Output parameter

      ArgValue indicates the value of key.

    GetValue "${INPUT_PARAMETER_LIST}" key

    username=$ArgValue

    Log

    Displays logs.

    • Input parameter

      message indicates the information of logs to be displayed.

    • Output parameter

      None

    Log "message"

    Exit

    Exits the script execution and displays logs.

    • Input parameter
      • 0 or 1 indicates the return code for exiting the script execution.

        0 indicates that the script is executed successfully, and 1 indicates that the script fails to be executed.

      • loginfo indicates the information of logs to be displayed.
      • result info indicates the information returned to the eReplication Agent.

        When the return code for exiting the script execution is 0, this parameter can be left blank. This parameter is mandatory when the return code for exiting the script execution is 1. Error message returned to the eReplication Agent is displayed.

    • Output parameter

      None

    Exit 1 -log "loginfo" -ret "result info"

  3. Save the edited script in directory /home/rdadmin/Agent/sbin/thirdparty/.
  • The preset scripts are stored in directory /Decompression path of the eReplication Agent software package /bin/thirdparty/rd_user/.
  • The customized scripts are stored in directory /Decompression path of the eReplication Agent software package /bin/thirdparty/.
  • The template scripts are stored in directory /Decompression path of the eReplication Agent software package /bin/thirdparty/sample/.

Windows

  1. Log in to the production application server as a user with the administrator rights and go to the directory where the customized script is stored.
  2. Edit the customized script.

    When editing the customized script, you are advised to run the call %~1\bin\agent_thirdpartyfunc.bat -init %~1 %~2 command to initialize the script to ensure that the variables and functions in the script are available.

    After the script is initialized, the available variables and functions are shown in Table 3 and Table Function list.

    Table 3 Variable list

    Name

    Description

    PID

    Unique ID

    AGENT_ROOT

    Root directory of the eReplication Agent

    AGENT_BIN_PATH

    bin directory of the eReplication Agent

    AGENT_LOG_PATH

    Log directory of the eReplication Agent

    AGENT_TMP_PATH

    Temporary file directory of the eReplication Agent

    COMMONFUNC

    Script path of the public function

    PARAM_FILE

    Temporary file that stores variables

    RSTFILE

    Temporary file that stores the error message returned by the script to the eReplication Agent

    LOGFILE

    Log file name

    LOGFILEPATH

    Full log path

    INPUTINFO

    Stores all variables transferred from the eReplication Agent to the script.

    Table 4 Function list

    Name

    Description

    Example

    Init

    Initializes the script.

    • Input parameter

      None

    • Output parameter

      None

    call %~1\bin\agent_thirdpartyfunc.bat -init %~1 %~2

    GainValue

    Obtains the value of input parameter key.

    • Input parameter

      key indicates obtaining key of a variable, such as InstanceName.

    • Output parameter

      None

    call %COMMONFUNC% "%AGENT_ROOT%" %CMD_GETVALUE% %PID% %LOGFILE% "!INPUTINFO!" "key" DBINSTANCE

    Log

    Displays logs.

    • Input parameter

      message indicates the information of logs to be displayed.

    • Output parameter

      None

    call %~1 \bin\agent_thirdpartyfunc.bat -log "message"

    Exit

    Exits the script and displays logs.

    • Input parameter

      message indicates the information of logs to be displayed.

    • Output parameter

      None

    call %~1 \bin\agent_thirdpartyfunc.bat -exit -log "message" -ret %RSTCODE% 1

  3. Run the call %COMMONFUNC% "%AGENT_ROOT%" %CMD_GETVALUE% %PID% %LOGFILE% "!INPUTINFO!" "key" var command to obtain the value of a variable.

    key is the keyword, and var is the variable that stores the variable value.

  4. Save the edited script in directory /home/rdadmin/Agent/sbin/thirdparty/.
  • The preset scripts are stored in directory /home/rdadmin/Agent/sbin/thirdparty/rd_user/.
  • The customized scripts are stored in directory /home/rdadmin/Agent/sbin/thirdparty/.
  • The template scripts are stored in directory /home/rdadmin/Agent/sbin/thirdparty/sample/.

Copyright © Huawei Technologies Co., Ltd.