Automic Workload Automation

Expand all | Collapse all

Workaround: Windows AE automated patching causes agents to not reconnect

  • 1.  Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 19 days ago

    Problem
    We still allow our non-production windows AE server to be patched automatically, after which we have to repair the MQSVC table before all of the agents can reconnect.

    Workaround
    The ServiceManagerDialog has a command line interface.  I've assigned a PowerShell script to run at server shutdown time that tells AE services to come down gracefully via this interface.  I added a 15 second pause as well to give them some time to complete their shutdowns.


    To assign this PowerShell script to run at server shutdown, I went into GPEDIT WindowsSettings/Scripts/Shutdown/Properties/PowerShellScripts



    ------------------------------
    Pete Wirfs
    SAIF Corporation
    Salem Oregon USA
    ------------------------------


  • 2.  RE: Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 15 days ago
    We are looking into the exact method for our Windows production environment.  Can you possibly share your PowerShell script!  :-)


  • 3.  RE: Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 15 days ago
    Edited by Pete Wirfs 15 days ago
    Well, it's not very elegant, so I'm not very proud of this script.  I hard coded a lot of stuff that should have been put into reusable functions, and some of the parameters should have been dynamically derived from the server.  But I didn't want to spend a whole lot of time worrying about form when I only cared about function, and I hard-coded everything to get the job done quickly.

    It does write a nice logfile though.  That helps me to see after the fact that it worked, and how many times it worked.  Our patch cycles typically invoke two reboots.

    So here it is;

    cls
    # ****** WHEN INVOKED BY SERVER SHUTDOWN, THIS SCRIPT WILL SHUTDOWN UC4 WP/CP SERVICES GRACEFULLY
    # ****** Add it to shutdown settings here: GPEDIT WindowsSettings/Scripts/Shutdown/Properties/PowerShellScripts
    # ****** Pete Wirfs, April 2021.

    # Derive log file location and name
    $MyPath = $PSScriptRoot
    $MyName = $MyInvocation.MyCommand.Name
    $MyName = $MyName.replace(".ps1",".log")
    $LogFile = $MyPath + '\' + $MyName
    write-host 'Log file will be written to "'$LogFile'"'

    write-output "$(get-date) ." | out-file $LogFile -append
    write-output "$(get-date) AE Shutdown script invoked" | out-file $LogFile -append

    # Shutdown of JWP
    write-output "$(get-date) Stopping JWP" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 JWP' -m Close

    # Shutdown of JCP
    write-output "$(get-date) Stopping JCP" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 JCP' -m Close


    # Shutdown of WP1
    write-output "$(get-date) Stopping WP1" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP1' -m Close

    # Shutdown of WP2
    write-output "$(get-date) Stopping WP2" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP2' -m Close

    # Shutdown of WP3
    write-output "$(get-date) Stopping WP3" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP3' -m Close

    # Shutdown of WP4
    write-output "$(get-date) Stopping WP4" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP4' -m Close

    # Shutdown of WP5
    write-output "$(get-date) Stopping WP5" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP5' -m Close

    # Shutdown of CP1
    write-output "$(get-date) Stopping CP1" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 CP1' -m Close

    # Shutdown of CP2
    write-output "$(get-date) Stopping CP2" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 CP2' -m Close

    # Shutdown of FTP
    write-output "$(get-date) Stopping FTP" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'FTP' -m Close

    # Shutdown of ORACLEDB
    write-output "$(get-date) Stopping ORACLEDB" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'ORACLEDB' -m Close

    # Shutdown of VARSERVICE
    write-output "$(get-date) Stopping VARSERVICE" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'VARSERVICE' -m Close

    # Shutdown of SQLDB
    write-output "$(get-date) Stopping SQLDB" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'SQLDB' -m Close

    # Shutdown of UC4DEV_AGENT
    write-output "$(get-date) Stopping UC4DEV_AGENT" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4DEV_AGENT' -m Close

    $WaitSeconds = 15
    write-output "$(get-date) $WaitSeconds second pause" | out-file $LogFile -append
    for($i = $WaitSeconds ; $i -gt 0 ; $i--)
    {
    Write-Progress -Activity "SHUTTING DOWN AE - `n Waiting for" -status "`$i equals $i seconds"
    sleep 1
    }

    write-host "we be finished"
    write-output "$(get-date) AE Shutdown script finished" | out-file $LogFile -append


    ------------------------------
    Pete Wirfs
    SAIF Corporation
    Salem Oregon USA
    ------------------------------