lvupdateRegScript Command

Purpose

The lvupdateRegScript command is used to register a script to be executed at notification points during an AIX® Live Update operation.

Syntax

To register a script, use the following syntax:
lvupdateRegScript  -a -n label -s script -d { orig | surr } -P phase -p priority
To unregister a script, use the following syntax:
lvupdateRegScript  -r -n label -d { orig | surr } -P phase [ -p priority ]
To list all registered scripts, use the following syntax:
lvupdateRegScript  -l

Description

The valid phases that a script can be registered for are as follows:

LVUP_CHECK
Executed at the beginning of a Live Update operation. This phase ensures the executed scripts that any associated services are ready for the Live Update operation.
LVUP_PRE
Executed before the applications are frozen on the original logical partition (LPAR). This phase allows the executed scripts to save any data as required before the applications are frozen.
LVUP_PRE_KERNEL
Executed after the applications are frozen on the original LPAR and before the applications are restarted on the surrogate LPAR. This phase is executed on the original LPAR before it is executed on the surrogate LPAR.
LVUP_POST
Executed on the surrogate LPAR after the applications are restarted. These scripts are executed in the chroot environment.
LVUP_ERROR
Executed in case of an error during the LVUP_CHECK phase or any later phase of the Live Update operation.
LVUP_COMPLETE
Executed on the surrogate LPAR after the Live Update operation is complete. This phase includes deletion of the original LPAR and resetting of the surrogate LPAR's UUID. The scripts that are registered for this phase are executed in the chroot environment.

During the Live Update operation, before the DR_CHECK scripts are invoked, the scripts that are registered with the LVUP_CHECK phase are executed. For the phases LVUP_CHECK, LVUP_PRE, LVUP_PRE_KERNEL, LVUP_POST, and LVUP_COMPLETE, the scripts are executed in a specific priority order that varies between the original and the surrogate logical partitions. On the original LPAR, the order is from priority 1 to priority 10, and the order is reversed on the surrogate LPAR, executing priority 10 first and on down to priority 1. In case of an LVUP_ERROR event, the scripts are executed in the opposite priority order.

The same methodology is applied to rest of the phases.

The script owner must specify if the script must be run on the original or the surrogate LPAR. If the script is to be run on both the original and the surrogate LPARs, it must be registered twice, once for the original LPAR and once for the surrogate LPAR.

When a registered script is executed, it must return 0 to indicate success, or a non-zero value if it failed. The Live Update operation fails if a script fails during the LVUP_CHECK or LVUP_PRE event.

Note: The script that is to be registered with the lvupdateRegScript command must be present in one of the following file systems: /, /var, /usr, /opt, /tmp.

Parameters

Item Description
label A string of up to 80 characters that specifies a label, which identifies a particular script.
script A string of up to 1024 characters that specifies a script to be executed. The string must contain the full path to the script as well as any desired arguments.
phase A string that specifies one of a set of phases: LVUP_CHECK, LVUP_PRE, LVUP_PRE_KERNEL, LVUP_POST, LVUP_ERROR, and LVUP_COMPLETE.
priority An integer from 1 to 10 that identifies a priority for executing the script.

Flags

Item Description
-a Registers a script to be executed during the Live Update operation.
-d orig | surr Specifies the LPAR on which the script is to be executed: original LPAR (orig) or surrogate LPAR (surr).
-l Lists the scripts and associated labels that are registered.
-n label Specifies a label to associate with a registered script.
-P phase Selects the phase when the script is to be invoked.
-p priority Specifies a priority from 1 to 10. The scripts that are registered for a particular phase are executed in order from highest (1) to lowest (10) priority.
-r Unregisters a script.
-s script Specifies the script to be executed.

Examples

  1. To list all the notification scripts that are registered to be invoked during the Live Update operation, enter the following command:
    # lvupdateRegScript -l
  2. To register a script to execute on the original LPAR during an LVUP_PRE event of the Live Update operation, enter the following command:
  3. To register a script to execute on the surrogate LPAR during the LVUP_POST event of the Live Update operation, enter the following command:
    # lvupdateRegScript -a -n putFiles -s "/opt/myapp/bin/rest_files /var/myapp/data"
                                  -P LVUP_POST -p 10 -d surr
  4. To remove a script that was previously registered to be invoked during the Live Update operation, enter the following command:
    # lvupdateRegScript -r -n getFiles -d orig -P LVUP_PRE