Yet another way to automate Caché shutdown on MS Windows platforms
After reading Stephen Wilson's article "Windows 7 performs shutdown too fast for Cache to close and so it gets forced down" I've recalled another solution that was based on Local Group Policy, which allows to control extra actions that should occur on computer startup or shutdown. How to add a computer shutdown script is well documented in MS Technet article. In short:
- being logged on as a domain admin, run Local Group Policy Editor (gpedit.msc)
- open Computer Configuration\Windows Settings\Scripts (Startup/Shutdown)
- double-click Shutdown
- in the Shutdown Properties dialog box, click Add, then Browse and choose a script (myfile.cmd) that should have been preliminary created in some folder. In my case it's just:
@echo off c:\intersystems\%1\bin\ccontrol stop %1
(I strictly follow the rule of identical naming the installation folders and the correspondent Caché instances; if they mismatch, there should be two parameters, %1 and %2).
- then set value[s] for parameter[s], in my case it's just: cache15
- after pressing Apply and OK the script is ready to run during the next OS shutdown.
Having parameters allows adding an instance of the same script for each Caché installation you have on your box (actual for developers/testers). In case of one (and only one) instance per server (typical for production) you can hardcode the script without patameters at all.
The advantages of this (scripting) approach are as follows:
- it provides normal Caché shutdown rather than a "quick" one,
- its timing out is fully controlled with one parameter only (Caché configuration, ShutdownTimeout),
- other Windows services are not affected with this kind of tuning; i.e. if some other (non-Caché) service will hang, OS will close it immediately without long wait for completion that might occur if WaitToKillServiceTimeout would be increased.
- Basing on Group Policy allows extending the solution to several Caché servers, if they are included in Active Directory domain and share the same disk/Caché configurations naming conventions.
Hope this info can be useful for somebody.