Run routine/classmethod immediately after cache start
Hi all,
Is there a way to setup a classmethod or routine to execute immediately after cache is started?
I wrote a batch file that does execute the cache start, but I'm getting an Access Denied error on the cession command despite running as Administrator:
ccontrol start HEALTHSHARE1
csession HEALTHSHARE1 -U %SYS "##class(SomeClass).SomeMethod()"
Thanks for the help/suggestions
Comments
Hello Nic,
One option for running code at Caché startup is the SYSTEM tag in ^%ZSTART. Have you considered this option?
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
put your code in a try { } catch { } block to prevent that Cache will not start if there are errors in your code
You may need to make the CACHELIB database R/W to save the edit to %ZSTART
No, because %Z* routines are stored in CACHESYS database. The only exception is `%ZEN.*`. You may want to check `do SHOW^%NSP` output:
Routine name/Range Type Dirset Target directory ------------------------------------------------------------------------------- ... [%SYS/:%Z) INT c:\intersystems\cache\mgr\cachelib\ [%Z:%ZEN.) INT c:\intersystems\cache\mgr\ [%ZEN.:%ZEN/) INT c:\intersystems\cache\mgr\cachelib\ ... =============================================================================== ... a square bracket [] means that left or right margin is inclusive, while a parenthesis means that the margin is exclusive...
You can add code at the SYSTEM label in the %ZSTART routine in %SYS. e.g.
SYSTEM do ##class(SomeClass).SomeMethod()
quit
You may need to make the CACHELIB database R/W to save the edit to %ZSTART.
Peter Lowndes
Safewire Limited
An older Mumpster would use routine ZSTU at %SYS-namespace, it does same thing as %ZSTART but doesn't need to write-enable CACHELIB.
Best Regards
Mauri
Hi,
Either ZSTU
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
or ZMIRROR if you're in a mirror configuration
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
Cheers