User bio
404 bio not found
Member since Jul 25, 2017
Posts:
Replies:
Try this method
Class DC.Util Extends %RegisteredObject
{
/// Return: the OS username for this Cache/IRIS instance
///
/// First, get the port of the superserver
/// then search, which job owns that port
/// then return the OSUsername for that job
///
ClassMethod OSUsername()
{
new $namespace
set $namespace="%SYS"
if ##Class(Config.Startup).Get(.par),$d(par("DefaultPort"),port) {
set job="", pattern=".e1""|TCP|"_port_"*"".e"
for set job=$zj(job) quit:$v(-1,job)?@pattern||(job="")
if job {
set proc=##class(%SYS.ProcessQuery).%OpenId(job)
ret:proc proc.OSUserName
}
}
ret ""
}
}
A note:
- I know of a $zu(...) function which works and returns the superserver port but $zu() functions are deprecated/discouraged
- and this one is not in the replacement list - why?
Now we have two time the same image... nice
Certifications & Credly badges:
Julius has no Certifications & Credly badges yet.
Global Masters badges:







Followers:
Following:
Julius has not followed anybody yet.
There is a somewhat "simple" method too
/// search for the superserver job /// return the OS Username for that job ClassMethod OSUsername() { new $namespace set $namespace="%SYS" set job="" for {set job=$zj(job) quit:job="" set prc=##class(%SYS.ProcessQuery).%OpenId(job) if prc, prc.JobType=24 ret prc.OSUserName } ret "" }