Use > Server patching > Patch management for Ubuntu > Remediate patch policies > Specify pre-installation and post-installation scripts for remediation

Specify pre-installation and post-installation scripts for remediation

For each patch remediation, you can specify a command or script to run before or after remediation. A pre-install script, for example, could check a certain condition on the managed server. If the condition is not met or if the pre-install script fails, the patches would not be installed. A pre-install script could also be used to shut down a service or application before it is patched. A post-install script could be used to perform a certain cleanup process on the managed server.

You can specify the following types of scripts to run on the managed server before or after a remediation process:

  • Pre-download: A script that runs before patches are downloaded from SA to the managed server. This is available only if you select Staged in the Remediate Options step.
  • Post-download: A script that runs after patches are downloaded from SA to the managed server and before the patch is installed. This is available only if you select Staged in the Remediate Options step.
  • Pre-install: A script that runs before patches are installed on the managed server.
  • Post-install: A script that runs after patches are installed on the managed server.

To specify a pre-install script:

  1. From the Remediate window, click Next to advance to the Pre & Post Actions step.
  2. Select the Pre-Install tab.

    You may specify different scripts and options on each of the tabs.

  3. Select the Enable Script check box. This option enables the remainder of the fields on the tab. If Enable Script is not selected, the script will not run.
  4. Select either Saved Script or Ad-Hoc Script from the drop-down list.

    A Saved Script has been previously stored in HPE Server Automation with SA Client. To specify the script, click Select.

    An Ad-Hoc script runs only for this operation and is not saved in SA. Select the Type, such as .bat. In the Script box, enter the contents of the script, including the drive letter of where the script is located, such as echo dir>> C:\temp\preinstall1.log. If you do not enter a drive letter, the default is %SYSTEMDRIVE%, which is where the system folder of Ubuntu is installed.

  5. If the script requires command-line flags, enter the flags in the Command text box.
  6. In the User section, if the system is not Local System, select Name.
  7. Enter the system name, your password, and the Domain name.
  8. To stop the installation if the script returns an error, select the Error check box.
  9. Click Next to go to the next step or click Cancel to close the Remediate window.