How to verify, that Ensemble instance is already installed by using ccontrol?

Hello,

as you can see in title my problem is with file ccontrol. I want to install whole Ensemble with Manifest if on machine wouldn't be any, or if I somehow find out instance of Ensemble I want to only use settings from included Manifest. I read that I can use file ccontrol to solve this task.

So can someone said me, how to work with ccontrol, is there some variable or function which returns me somethig? I have read some parts of documentation about ccontrol, but nothing help me so much, so you can give me link to part in documentation, where is this desribed.

My easy solution coud be, that I use ccontrol list which returns me information about installed instance, if the instance isn't on machine it will return error, which I verify in if condition, this maybe coud work, but I think/hope that there must be some better solution.

So thank you for your answers.

Zdeněk

Answers

Use ccontrol qlist to get structured information about available instances.

ccontrol qlist [<instance>] [nodisplay > outputfile]
Display a quick list of information about all installed instances, in a format suitable for parsing in command scripts.
The record for an instance contains fields separated by "^" (carats):

  • Field 1: instance name
  • Field 2: instance directory
  • Field 3: version identifier
  • Field 4: current status for the instance
  • Field 5: configuration file name last used
  • Field 6: SuperServer port number
  • Field 7: WebServer port number
  • Field 8: JDBC Gateway port number
  • Field 9: Instance status (e.g., ok, warn, alert)
  • Field 10: Product name of the instance
  • Field 11: Mirror Member Type (e.g., Failover, Disaster Recovery)
  • Field 12: Mirror Status (e.g., Primary, Backup, Connected)

Ok thank you I've got it, but I've got here something else, if I do this verify and result will be, that Ensemble is installed, how can I start only Manifest, my idea was, that I could invoke Ensemble terminal by ccontrol, and somehow type here commands, but is there any possibyllity how can I do this only from cmd, without typing by my hands?

Thank you, I'm so grateful to you.

Sure

csession {INSTANCE} -U{NAMESPACE} < {SCRIPT}

Script contains code you want to execute, in your case the call to installer manifest. It could be a file or just the code itself.

Example.

A series of articles about automating CI/CD.

Ok finally I try to put there this line of code do ##class(User.Installer).setup()  but as you can guess it doesn't working, According to documentation it should be COS code is that right? Then I tried put there Installer file, but it's .xml it must be rouitne or not? 

I'm appologise, that I restrain you, but I started recently and I'm not completely friend with Ensemble.

Again thank you for your time.

First two lines of your script should probably be user and password, unless you're running a minimal security install or enabled OS authentication.

ObjectScript code after that, yes, sothis looks correct

do ##class(User.Installer).setup()  

Maybe you need to load User.Installer beforehand?

Use $system.OBJ.Load(file, "c") to load and compile class(es) you need.

I've got minimal security settings

Then you don't need to provide user and password.

  I can use this method right Login(Username As %String, Password As %String)?

No. First line of script - user, second line - password. After that - ObjectScript.

Do $system.OBJ.Load("Installer.xml", "c") I dont know why. 

Try full path. Also this method returns status, check it:

Set sc =  $system.OBJ.Load("/path/to/Installer.xml", "c")
Write:('sc) $System.Status.GetErrorText(sc) 

Ok

In terminal it's working fine, but in my .cmd script no. If i run this:

csession Cache -U%SYS do $system.OBJ.Load("C:\Users\Zdenda\Desktop\install\Installer.xml", "c")

It return an error like this:

You need to either escape your command or use a separate file for a script. I recommend a file.

What type of script it should be? Another .cmd or which one please?

Ok thanks, I've got it, but still the same error Invallid arguments...

Well, show your cmd script (as text) and ObjectScript script.

In .cmd file is this:

@ECHO OFF

cd /

cd InterSystems\bin

type NUL > file.txt

ccontrol qlist Cache nodisplay > file.txt

set instance = ""

FOR /F "tokens=1 delims=^" %%x in (file.txt) DO set instance=%%x

echo %instance%

IF "%instance%" NEQ "" (

    csession Cache -U%SYS < C:\Users\Zdenda\Desktop\run.script

) ELSE (
    
    Echo Somenthing goes wrong with error number %ERRORLEVEL%.
)

del file.txt

::FOR /F "tokens=1 delims=^" %%x in (file.txt) DO echo %%x

Pause

And in file run.script is this code:

Do $system.OBJ.Load("C:\Users\Zdenda\Desktop\install\Installer.xml", "c")
Do ##class(User.Installer).setup()

I really don't know why.. Thanks a lot..

Try

C:\InterSystems\Cache\bin\cache.exe -s C:\InterSystems\Cache\mgr -U %%SYS C:\Users\Zdenda\Desktop\run.script 

I suggest you contact the WRC for this problem.

I think the problem is in the command escaping.

After long thinking and reading some documentation, I'm maybe closer to solve this problem.

I stardet using ccotrol and by this commad I started terminal where I'm trying to invoke some code.

It looks like this:

 

But as you can see terminal returns me Access Denied. I don't know why.. I've installed Ensemble with minimal security parameters.

Is this information or porgress somehow helpful for you, can you now give me some advices how to do this?

Thanks again!