but it results in "<INVALID ARGUMENT>". Is this correct way of running objectscript code on Linux? Sorry if this comes across as a silly question but I am just getting familiar with Cache and its concepts.
You can get an output from a Caché routine provided it do some output to its principal device (= stdout), e.g. (approach #1):
$ csession CACHE "##class(%SYSTEM.License).CKEY()"
Cache Key display:
Based on the active key file '/vol/cachesys/mgr/cache.key'
LicenseCapacity = Cache 2017.1 Enterpriser - Concurrent Users:1000000, Anything You Need
CustomerName = ZAO XX.XXX
OrderNumber = 9876543210
ExpirationDate = 10/15/2114
AuthorizationKey = 3141592653592718281828662607004081
MachineID =
currently available = 9997
minimum available = 97
maximum available = 1000000
$
as there is no way to pass an arbitrary text from COS routine to OS directly. To bypass it, just incorporate into your shell script a calling sequence like this (approach #2):
#!/bin/bash
csession CACHE <<EOF >output.txt
write ##class(%SYS.System).InstanceGUID()
halt
EOF
After calling it, you will get output.txt like this:
(Missing 'halt' command causes an error). All you have to do is to parse an output. To avoid this, you may want to write a small wrapper in COS that will provide an output as you need it, than you'll be able to follow an approach #1.
The instance is assigned a GUID that you can retrieve using the InstanceGUID() method of the %SYS.System class:
Databases are not assigned such an identifier.
Thanks for quick response.
Now, I am trying to run the following code on a Linux box as follows (CACHE is the instance name):
"csession CACHE -U"%SYS" "w ##class(%SYS.System).InstanceGUID()"
but it results in "<INVALID ARGUMENT>". Is this correct way of running objectscript code on Linux? Sorry if this comes across as a silly question but I am just getting familiar with Cache and its concepts.
Thanks,
Raghu
First run:
Then:
As %SYS is a % package it is available in every namespace.
As the last argument, you should use routine or classmethod, not command.
You can get an output from a Caché routine provided it do some output to its principal device (= stdout), e.g. (approach #1):
as there is no way to pass an arbitrary text from COS routine to OS directly. To bypass it, just incorporate into your shell script a calling sequence like this (approach #2):
After calling it, you will get output.txt like this:
(Missing 'halt' command causes an error). All you have to do is to parse an output. To avoid this, you may want to write a small wrapper in COS that will provide an output as you need it, than you'll be able to follow an approach #1.
HTH.
Just to complete an exercise:
Excellent. Thanks to everyone who chimed in. Much appreciated.
Raghu.
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue