savestat

The savestat utility enables you to store and retrieve up to 20 values to persistent storage. The utility is designed to identify where you left off in an installation script even when a system reboot is required. This utility is designed to return values that set the ? environment variable so that you can branch in a script (.sh) file based on the result of the utility's execution.

The savestat utility uses the persistent storage capability of the ASU command. Therefore, for the script to work, the following files must be available:

Usage

The savestat utility that comes with the Scripting Toolkit uses the following command-line syntax:
SAVESTAT [/q] -set1=value [...-set2=value ... -set21=value]
SAVESTAT [/q] -getn
SAVESTAT [/q] -validate
SAVESTAT [/q] -signature
Parameter Description Usage
-setn=value
Saves an integer value, value, to the nth location in persistent-storage memory, where n is an integer from 1-21.
Return codes:
  • 0 if successful
  • 1 if not successful
./savestat.sh -setn=value
Where:
  • n is an integer from 121
  • value is an integer from 0254
-getn
Retrieves a value currently set in the nth location in persistent-storage memory.
Return codes:
  • The value stored at the location specified by n, if successful.
  • 255 if not successful.
./savestat.sh -getn

Where n is the location of a previously-stored value.

-signature
Verifies that the persistent storage contains the savestat signature.
Return codes:
  • 0 if storage contains the signature
  • 1 if storage does not contain the signature
./savestat.sh -signature
-validate
Verifies that the system is supported by savestat.
Return codes:
  • 0 if the system is supported
  • 1 if the system is not supported
./savestat.sh -validate
-q
Invokes the quiet mode, which suppresses prompts. This parameter is optional and can be used with any other savestat parameter.
./savestat.sh -q -set1=100
Note: The help for savestat.sh indicates that the reset parameter is supported. savestat.sh does not currently support the reset parameter. To reset all of the storage locations to zero, use the savestat.sh set command as shown here:
savestat.sh --set1=0 --set2=0 --set3=0 --set4=0 --set5=0 --set6=0 --set7=0
--set8=0 --set9=0 --set10=0 --set11=0 --set12=0 --set13=0 --set14=0
--set15=0 --set16=0 --set17=0 --set18=0 --set19=0 --set20=0 --set21=0

Examples

The following examples illustrate how to use the savestat utility.
Example Description
./savestat.sh -set2=100
Stores the value 100 in the second persistent-storage memory location.
./savestat.sh -get2

if  [ $? eq 100 ]; then
  echo The value 100 was found successfully.
else
  echo The value 100 was not found.
fi
Retrieves the value of the second persistent-storage memory location and branches in the script file according to the value returned.