Shutdown scripts
- Last UpdatedAug 06, 2024
- 3 minute read
Shutdown scripts are called when the object is about to be removed from memory, usually as a result of the AppEngine stopping. Shutdown scripts are primarily used to destroy COM objects and .NET objects and to free memory.
Shutdown scripts for redundant AppEngines
There are certain considerations that you must take into account when writing a Shutdown script that will run on redundant AppEngines. This section outlines whether or not a script will be executed under various scenarios, including including deploy, forced failover, system failure, system startup, and undeploy operations.
Redundant engines can be set to run in either Legacy Mode or Run Warm Mode. Shutdown scripts for redundant engines may operate differently, depending on the selected redundancy mode.
Note: The warm redundancy feature was introduced in System Platform 2020 R2 SP1. New redundant engines default to Run Warm Mode. Galaxies with redundant engines that were created prior to System Platform 2020 R2 SP1 and migrated to the current System Platform version default to Legacy Mode.
Shutdown scripts for redundant engines may operate differently, depending on which redundancy mode is selected.
-
Legacy mode (RunWarm attribute is disabled): In Legacy mode, the Standby Engine does not start until failover occurs. This will result in longer failover times when compared with Run Warm Mode. Highlighted text indicates where there is a difference in script execution between Legacy mode and Warm Redundancy mode.
|
Legacy mode |
Primary engine (server 1) |
Backup engine (server 2) |
Shutdown script |
||
|---|---|---|---|---|---|
|
Action |
Initial state |
End state |
Initial state |
End state |
Script execution |
|
Deploy |
Down |
Active OnScan |
Down |
Standby |
Shutdown scripts do not execute during a deploy operation. |
|
Forced Failover |
Active OnScan |
Standby |
Standby |
Active OnScan |
Shutdown scripts execute when the primary engine shuts down. |
|
Server 1 Failure (hard shutdown) |
Active OnScan |
Down |
Standby |
Active OnScan |
Shutdown scripts do not execute in the event of a hard shutdown. |
|
Server 2 Failure (hard shutdown) |
Active OnScan |
Active OnScan |
Standby |
Down |
Shutdown scripts do not execute in the event of a hard shutdown. |
|
Graceful shutdown of Server 1 platform or engine using OCMC |
Active OnScan |
Down |
Standby |
Active OFFscan |
Shutdown scripts execute when the Primary Engine shuts down. |
|
Graceful shutdown of Server 2 platform or engine using OCMC |
Active OnScan |
Active OnScan |
Standby |
Down |
Shutdown scripts do not execute when server 2 is shut down. because the backup engine was never started. |
|
Start Server 1 only |
Down |
Active OnScan |
Down |
Down |
Shutdown scripts do not execute. |
|
Start Server 2 (Server 1 running) |
Active OnScan |
Active OnScan |
Down |
Standby |
Shutdown scripts do not execute. |
|
Undeploy |
Active OnScan |
Down |
Standby |
Down |
Shutdown scripts execute during an undeploy operation as the active engine is shut down. In legacy mode, the backup engine was never started. |
-
Run warm mode (RunWarm attribute is enabled): In Run Warm mode, the Standby Engine executes Startup scripts until it becomes active. Highlighted text indicates where there is a difference in script execution between Legacy mode and Warm Redundancy mode.
|
Warm redundancy mode |
Primary engine (server 1) |
Backup engine (server 2) |
Shutdown script |
||
|---|---|---|---|---|---|
|
Action |
Initial state |
End state |
Initial state |
End state |
Script execution |
|
Deploy |
Down |
Active OnScan |
Down |
Standby |
Shutdown scripts do not execute during a deploy operation. |
|
Forced Failover |
Active OnScan |
Standby |
Standby |
Active OnScan |
Shutdown scripts execute when the primary engine shuts down. |
|
Server 1 Failure (hard shutdown) |
Active OnScan |
Down |
Standby |
Active OnScan |
Shutdown scripts do not execute in the event of a hard shutdown. |
|
Server 2 Failure (hard shutdown) |
Active OnScan |
Active OnScan |
Standby |
Down |
Shutdown scripts do not execute in the event of a hard shutdown. |
|
Graceful shutdown of Server 1 platform or engine using OCMC |
Active OnScan |
Down |
Standby |
Active Offscan |
Shutdown scripts execute when the primary engine shuts down. |
|
Graceful shutdown of Server 2 platform or engine using OCMC |
Active OnScan |
Active OnScan |
Standby |
Down |
Shutdown scripts execute when server 2 is shut down because in run warm mode, the backup engine was started previously. |
|
Start Server 1 only |
Down |
Active OnScan |
Down |
Down |
Shutdown scripts do not execute. |
|
Start Server 2 (Server 1 running) |
Active OnScan |
Active OnScan |
Down |
Standby |
Shutdown scripts do not execute. |
|
Undeploy |
Active OnScan |
Down |
Standby |
Down |
Shutdown scripts execute during an undeploy operation as the servers shut down. In run warm mode, both engines were started and are now shut down. |