Restarting Cache from inside

Dear colleagues,

a recent project came up with the question if it is possible to "restart Cache from inside", ie. using a COS-routine.

Thank you in advance and regdards



  • + 1
  • 0
  • 757
  • 2
  • 3


While your code interrupted when server shutdown, you can't do it directly. But I think you can try to call restart service of cache. So you should look at possiblilties OS, which you use for this server.


The application I work with uses a tier configuration of ECP application servers over a Cache mirrored database pair.  The reboot of this tier is handled automatically by Cache classes that break down the reboot into three phases.  Special Linux accounts are called from the classes  via secure shell to handle reboot commands and Cache.  The primary database mirror member handles phase one, basically shutdown process on application servers  and then passes control to the backup member to do phase two.  During phase two, the backup member reboots the primary and returns control back to the original primary for phase three.   During phase three the backup member is rebooted, once completed all application servers are rebooted.  What used to take 45 minutes manually is now done in 16 minutes by Cache


If all you're really looking to do is shut down the instance, you can do this with a $zf(-2) callout to the OS to call 'ccontrol stop <instance> quietly restart' (or 'ccontrol stopstart <instance>' if you are on Windows). Do not use $zf(-1) for this, as shutdown would wait for the $zf(-1) calling process until reaching the ShutdownTimeout value. See this doc for an example of using $zf(-2):

Thanks Pete,


this is exactly what we need in our project.



Here is what I use:

set cmd=$P($ZU(12),"\",1,$L($ZU(12),"\")-2)_"\bin\ccontrol stopstart "_$P($ZU(86),"*",2)
d $zf(-2,cmd)

Replace 'stopstart' with 'stop' , 'force' etc ...