GetEnviron() on CentOS
Why I'm not getting OS level environmental variable in the IRIS for below actions:
CentOS termial:
[root@]# export TEST="test"
[root@]# echo $TEST
test
[root@]# iris session MYIRIS
Node: myiris01, Instance: MYIRIS
Username: User
Password: ********
NSPACE>s test = $SYSTEM.Util.GetEnviron("TEST")
NSPACE>w test
NSPACE>
Comments
Most likely because IRIS is running as user irisusr (or similar) rather than root.
Well that might not have been quite correct ...
jeff@ourawai03:~$ export TEST="test"
jeff@ourawai03:~$ iris session ih
Node: ourawai03, Instance: IH
HICG>w $system.Util.GetEnviron("TEST")
test
HICG>Indeed, but I thought `export VAR="var"` is system wide compared just to local/user `VAR="var"`
export flags the variable to be available in child processes, but only affects the current account in an interactive shell.
jeff@ourawai03:~/tmp$ a="hey" jeff@ourawai03:~/tmp$ echo $a hey jeff@ourawai03:~/tmp$ bash jeff@ourawai03:~/tmp$ echo $a jeff@ourawai03:~/tmp$ exit exit jeff@ourawai03:~/tmp$ export a="hey" jeff@ourawai03:~/tmp$ bash jeff@ourawai03:~/tmp$ echo $a hey
What happens when you enter:
NSPACE>!echo $TEST
also, try
NSPACE>!whoami
First command comes blank
Second throws that:
NSPACE>!whoami
root
I have solved it by adding ENV var in the
/etc/environment
Tried to reproduce on RHEL9, but I got the test value, same as @Jeffrey.Drumm.
Are you actually not getting the TEST env var? Or some other env var? IRIS process overwrites some env vars on start