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.
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.
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.
Script parameters are not case-sensitive.
|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.|
|Specifies if the script is to keep processing if it runs into errors. By default, the NSH Script uses |
|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.|
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:
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.
Deletes a specific type of object. To use this parameter, you must be using an execution mode of
|Deletes objects from the database that were created by a specific role.|
|Lists the device names which have an Application Server cache or a repeater. The execution modes |
|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|
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.
|Cleans up BMC Server Automation historical data for the specified |
|Cleans up BMC Server Automation objects older than the |
Cleans up BMC Server Automation historical data for objects of the specified
|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.|
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.
|Performs a BMC Server Automation Database cleanup with the duration limitation specified in the |
|Deletes database rows for shared data objects with the duration limitation specified in |
|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.
|Performs a FileServer cleanup with the duration limitation specified in the |
|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.
Cleans up old temporary files on a target server (agent) that are older than the
|Deletes old temporary files on all the Application Servers that are currently up and running (and accessible). It removes files older than the |
|Deletes old temporary files on a specific Application Server (any files older than the |
|Cleans up files from the staging directory of a repeater server. This cleanup removes files that have not been accessed for the |