Articles in this section
Category / Section

How to move patch files into the installation directories and restart services automatically?

Published:

Overview

The Patch Controller (patchctl) scripts automate patch management for applications across Windows and Linux environments. These scripts simplify the process of:

  • Backing up existing application files (e.g., DLLs).
  • Applying patch files to update components.
  • Rolling back to the previous state using backups.
  • Restarting associated services (IIS App Pools on Windows, systemd services on Linux).

Windows Script

Requirements

  • Administrator privileges.
  • PowerShell 5.1 or higher.
  • patch.json configuration file in the same directory.

Usage Explained

For Windows, the patch controller script is a PowerShell script named patchctl.ps1. It supports two main operations:

  1. Update (Apply Patch) 
    Command:   
    .\patchctl.ps1 -patch update
    What it does:
    • Reads the patch.json configuration file.
    • Creates a backup of the existing application files (DLLs) in a versioned folder.
    • Copies the new patch files from the /patch folder to the specified destination paths.
    • Restarts the associated IIS App Pools to apply changes.

Sample for the Bold BI service 

Bold BI Api Service 

  1. Rollback (Restore Previous State) 
    Command:  
    .\patchctl.ps1 -patch rollback
    What it does:
    • Restores the original files from the backup folder created during the update process.
    • Restarts the IIS App Pools to revert the application to its previous state.

Sample for the Bold BI service 

Bold BI Api Service 


Features

  • Backup: Saves current DLLs to a versioned folder.
  • Update: Replaces DLLs with patch files.
  • Rollback: Restores DLLs from backup.
  • Service Restart: Restarts IIS App Pools.

Linux Script

Requirements

  • Root privileges (via sudo).
  • Bash shell.
  • Python 3 (for JSON parsing).
  • patch.json and patch/ folder in the same directory.

Usage Explained

For Linux, the patch controller script is a PowerShell script named patchctl.sh. It supports two main operations:

  1. Update (Apply Patch) 
    Command:   
    sudo ./patchctl.sh --patch update
    What it does:
    • Reads the patch.json configuration file.
    • Creates a versioned backup of the existing application files.
    • Copies the new patch files from the /patch folder to the specified destination directories.
    • Restarts the associated systemd services to apply the changes.
  2. Rollback (Restore Previous State) 
    Command:  
    sudo ./patchctl.sh --patch rollback
    What it does:
    • Restores the original files from the backup folder created during the update process.
    • Restarts the systemd services to revert the application to its previous state.

Features

  • Backup: Copies existing files to a versioned backup folder.
  • Update: Replaces files with patch versions.
  • Rollback: Restores files from backup.
  • Service Restart: Uses systemctl to restart services.

Configuration File: patch.json

Structure

{
    "patchVersion": "14.1.10_11032025_123411",
    "bi_api": {
        "source": [
            "patch/BoldBi.Ai.Core.dll"
        ],
        "destination": [
            "bi/dataservice",
            "ai/aiservice"
        ],
        "service": [
            "BoldBiDesigner",
            "BoldBIApi"
        ]
    }
}
Notes
  • source: Patch file names.
  • destination: Relative paths under install root.
  • service: App Pool names (Windows) or systemd service names (Linux).

Best Practices

  • Verify patch.json before running the script.
  • Ensure patch files exist in the /patch folder.
  • Use versioned patchVersion to avoid overwriting backups.
  • Run rollback only after an update has been performed.
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
RR
Written by Raji Rajendran
Updated:
Comments (0)
Access denied
Access denied