Question Adam Raszkiewicz · Aug 18, 2023

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

Jeffrey Drumm · Aug 18, 2023

Most likely because IRIS is running as user irisusr (or similar) rather than root.

0
Jeffrey Drumm  Aug 18, 2023 to Jeffrey Drumm

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>
0
Adam Raszkiewicz  Aug 18, 2023 to Jeffrey Drumm

Indeed, but I thought `export VAR="var"` is system wide compared just to local/user `VAR="var"`

0
Jeffrey Drumm  Aug 18, 2023 to Adam Raszkiewicz

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
0
Jeffrey Drumm  Aug 18, 2023 to Adam Raszkiewicz

What happens when you enter:

NSPACE>!echo $TEST

also, try

NSPACE>!whoami

0
Adam Raszkiewicz  Aug 21, 2023 to Jeffrey Drumm

First command comes blank

Second throws that:

NSPACE>!whoami
root

0
Adam Raszkiewicz  Aug 21, 2023 to Jeffrey Drumm

I have solved it by adding ENV var in the

/etc/environment

0
Eduard Lebedyuk · Aug 21, 2023

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

0