BMC Server Automation provides a default Network Shell script and Network Shell Script Job that you can use to check and clean various elements of the BMC Server Automation infrastructure, using BLCLI cleanup commands. You can edit and adjust this Database Cleanup script according to your cleanup needs.
Note
For the script to function properly, the role that runs the script must be granted the BL_Administration.System_Cleanup authorization.
To examine or change the options and commands included in the default script:
The following topics describe the options, parameters, and commands that you can use with the Network Shell script.
The Script Options panel provides identifying information for the Network Shell script. The default settings are shown in the following figure.
The Script Type setting must be set to Execute the script once, passing the host list as a parameter to the script, with the Allow run with no targets option selected.
The script executes repeatedly from the Application Server, each time running on a different server. This option uses the Network Shell runscript program, which can run the same script on multiple machines. The script uses environment variables local to the Application Server.
The Parameters panel lets you define parameters that are replaced with server property values when the script runs. Using this panel, you can add flags to parameters, you can specify whether the flag is required at runtime, and, if necessary, require a value to be provided for the flag. In addition, you can define a default value for a flag, make the default value editable when the script is run, and require a value to be entered for the flag at runtime.
Note
If you do not plan to use certain parameters and want the script to ignore them and not take them into account, you can set their flags to a value of ignore (in the Value column).
When you deploy a Network Shell script, BMC Server Automation automatically generates a master script that controls the script's deployment and execution. The system uses the parameters defined here to generate values in the master script.
The following figure shows the parameters for the script. The following table describes the parameters.
Note
Script parameters are not case-sensitive.
Parameter name | Flag | Description |
---|---|---|
ExecutionMode |
| Sets the Execution mode for the script. There are two options: Typical mode and individual command mode. |
With the Typical mode, the script executes a series of recommended delete commands. The script executes the following commands in the order listed below:
| ||
You can also choose to execute an individual delete command. Enter one of the values shown in Supported execution modes to execute an individual delete command. This option is useful if you want to cleanup a specific type of data, such as agent logs. | ||
ContinueOnError |
| Specifies if the script is to keep processing if it runs into errors. By default, the NSH Script uses Continue on error = true . If set to true , upon encountering an error the script will log the error and then continue with the cleanup run. |
MaxDuration |
| Specifies the overall maximum run-time for the script. By default, the NSH Script uses an overall maximum run-time of 720 minutes. You can change the overall maximum duration default value. |
DurationDistribution |
| Distributes the run-time across the delete commands in below shares (percent).
These are the recommended settings for the script. BMC recommends that you do not change these settings. However, if you are very familiar with the landscape of the objects in the database that you want to delete, then you might want to adjust the settings. To adjust the settings, enter the settings in quotes, as shown below: |
RetentionTime |
| Specifies the number of days that must be exceeded for the script to delete the specified data. This parameter is used by the following execution modes:
It is used by the following BLCLI commands:
The default value is 14 days. |
condObjectType |
| Deletes a specific type of object. To use this parameter, you must be using an execution mode of
|
RoleName |
| Deletes objects from the database that were created by a specific role. |
TargetDevices |
| Lists the device names which have an Application Server cache or a repeater. The execution modes CLEAN_AS and CLEAN_REPEATER use this parameter. |
TargetSize |
| Specifies the maximum size, in MB, for the repeater staging directory. |
The following table lists the BLCLI commands and the mode values that are supported for use with the database and file server cleanup script.
Mode value | Command executed | What it does |
---|---|---|
HISTORY | Delete cleanupHistoricalData | Cleans up BMC Server Automation historical data based on retention time. Historical data includes Compliance Job results, Audit Job results, Snapshot Job results, Patch Job results, Deploy Job results, job run events, job schedules, and the audit trail. |
HISTORY_O | Cleans up BMC Server Automation historical data for the specified OBJECT_TYPE (a required argument) using the default retention of 14 days. | |
HISTORY_RDR | Cleans up BMC Server Automation objects older than the RetentionTime parameter value for RoleName . The RoleName parameter can be literally null to cleanup data from all roles. | |
| Cleans up BMC Server Automation historical data for objects of the specified | |
RETENTION | Delete executeRetentionPolicy | Marks entries for deletion based on retention time in the BMC Server Automation database. It marks old job runs and automatically created jobs and depot objects. |
CLEAN_DB | Delete cleanupDatabase | Deletes database rows for objects that have been previously marked for deletion. Note: Certain objects are not deleted due to potential object dependencies. The cleanup process deletes all top-level model objects of the classes listed in the hk_allowed_classes database table, as well as all their child classes (which are not listed in this table). BMC recommends that you do NOT modify the contents of the hk_allowed_classes table. |
CLEAN_DB_TL | Performs a BMC Server Automation Database cleanup with the duration limitation specified in the DurationDistribution parameter. | |
CLEAN_OBJECTS | Delete hardDeleteAllSharedObjects | Deletes database rows for shared data objects with the duration limitation specified in DurationDistribution parameter. It includes data for shared files, checksum files, ACL entries, and internal values generated by BMC Server Automation. |
CLEAN_FS | Delete cleanupFileServer | Cleans all the unused files from the file server and from temporary file storage on the Application Server. Note: When a Custom Package Deploy Job runs, it creates a subdirectory under the BLPackage directory for every iteration. Even after the job run history is removed by the retention policy, these directories still exist. These directories are not removed by the cleanup script. |
CLEAN_FS_TL | Performs a FileServer cleanup with the duration limitation specified in the DurationDistribution parameter. | |
CHECK_FS | Delete checkFileServerIntegrity | Performs a FileServer integrity check. |
|
| Deletes all objects marked for deletion and cleans all unused files from the file server and the temporary file storage area on the Application Server. |
CLEAN_AGENT | Delete cleanupAgent | Cleans up old temporary files on a target server (agent) that are older than the |
CLEAN_ALL_AS | Delete cleanupAllAppServerCaches | Deletes old temporary files on all the Application Servers that are currently up and running (and accessible). It removes files older than the RetentionTime parameter value. |
CLEAN_AS | Delete cleanupAppServerCache | Deletes old temporary files on a specific Application Server (any files older than the RetentionTime parameter value). |
CLEAN_REPEATER | Delete cleanupRepeater | Cleans up files from the staging directory of a repeater server. This cleanup removes files that have not been accessed for the RetentionTime parameter value. |