Question
· Oct 3, 2018

Ccontrol list execution through Cache Object scripting

Hi 

Anyone worked on "ccontrol  list " command execution through Cache Object Scripting.

I executed through  bat file passing this ../bin ccontrol  list  . Icould not get the results through COS  but executed in command prompt 

it pops up with notepad and list down Cache instances.

Need help here to address the same stuff through cache object scripting.

Discussion (3)1
Log in or sign up to continue

You can output the list to a file using this command...

ccontrol list nodisplay > mylist.txt

You could then create a class method to return the contents as a string, something along these lines using $ZF to run the command...

Class Foo.Ccontrol Extends %RegisteredObject
{

Parameter FOLDER = "C:\InterSystems\Cache2017\bin\";

Parameter FILE = "mylist.txt";

ClassMethod GetList()
{
  do $ZF(-1,..#FOLDER_"ccontrol list nodisplay > "_..#FILE)
  set stream=##class(%Stream.FileCharacter).%New()
  set sc=stream.LinkToFile(..#FOLDER_..#FILE)
  quit stream.Read()
}

}