What the Cache class to find the NodeName
Hi,
I have a requirement to convert uname -n (Unix comamnd) with its equivalent Cache class. Can anyone help on this please
Thanks & Regards,
Sadagopan TS
Hi,
I have a requirement to convert uname -n (Unix comamnd) with its equivalent Cache class. Can anyone help on this please
Thanks & Regards,
Sadagopan TS
I think that may be a custom routine. I don't recognize it as a Caché-supplied resource.
There is no such routine available in the application. We are using HP-UX. It looks like it return the Servername.
%ZNODENAME appears to be a statically linked callout function (see http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...). This is specific to your code / application / environment and isn't something generic to Caché.
If you are interested in retrieving your server name, try using:
$piece($system,":")
Hi On further checking, i am able to found the below C code to get the %ZNODENAME. Is there any equivalent Cache class to get this. Ideally, uname -n is the unix command, for which equivalent Cache class is required
#include <sys/utsname.h>
int get_nodename(STRING)
char *STRING;
{
struct utsname name;
uname(&name);
strcpy(STRING, name.nodename);
return(0);
}
Another option is:
(see class reference)
uname -n is generally documented as returning a network host name but systems can be configured with multiple networks and it is not defined exactly what uname -n means at that point.
The methods above, the $SYSTEM variable, ##class(%SYS.System).GetNodeName(1) and $System.INetInfo.LocalHostName() all return the network host name which will match uname -n if there is only one network host name on the system. $SYSTEM.InetInfo has additional methods which can be used if there is more than one host name associated with a given system.
Note that the $SYSTEM variable is loaded at system startup and can be overridden with a fixed name as part of the Cache' configuration so on some systems it may differ than what the other methods will return.
Many thanks for your advice