Run routine/classmethod immediately after cache start

Caché

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

  • 0
  • 0
  • 365
  • 3
  • 3

Answers

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

 

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...

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

Comments