Question
CM Wang · Jun 26, 2017

The COS APIs to get O.S version and the Cache installed directory

Hi,

I would like to retrieve the O.S version (Windows or Unix) and Cache installed directory.

which COS apis should I use ?

Thanks for your help.

0
0 592
Discussion (2)1
Log in or sign up to continue

$System.Util.InstallDirectory() can be used to obtain the install directory.

$System.Version.GetOS() returns the OS for which the product was built.  Note that this method essentially just parses this information out of the $ZV string.

The Caché installation directory is easy:

USER>w $System.Util.InstallDirectory()
c:\intersystems\healthshare_4\

The OS version is OS-dependent.

On Windows only:

USER>write $System.Util.GetOSVersionInfo()
6.1.7601

On Unix:

USER>set sc = ##class(%Net.Remote.Utility).RunCommandViaZF("uname -r",,.tOutput) write tOutput
2.6.32-220.el6.x86_64

USER>set sc = ##class(%Net.Remote.Utility).RunCommandViaZF("lsb_release -a",,.tOutput) write tOutput
LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.2 (Santiago)
Release:        6.2
Codename:       Santiago