BookmarkSubscribeRSS Feed
fkildegaard
Fluorite | Level 6

Hi Community,

 

I have a customer that wants to setup a Sandbox in their development environment (In a GRID on Linux (SAS 9.4M6)). This means that each user have their own autoexec and their own sasenv.sh file where they can set their own environment variables. If the user does not have a personal user folder then a common autoexec and sasenv.sh file should be read.

 

For the autoexec, I usually use %sysget('METAUSER') to find the user logged in and this works for other machines in the environment with a Workspace Server, but it seems that there is no METAUSER environment variable set on the machines in the GRID. I have checked the production environment and it seems to be the same case here. You can see how I have verified this if you go to the appendix in the bottom. 

So my workaround for the autoexec is to use the %mduextr macro instead. From here I can find the user logged in as well and then I can %include the correct autoexec for the user. It takes a little bit longer time start up, but I can live with that. However, it would be nice, if there is a way to add the METAUSER environment variable to the GRID machines also. Is it possible?

 

 

For the environment variables I am running a custom .sh file that needs to set the correct environment variables and the code looks like this:

 

if [[ -f "$SANDBOX/$USER/sasenv.sh" ]] ; then
        . $SANDBOX/$USER/sasenv.sh
else . $CURRENT_LEVEL_ROOT/SASApp/sasenv.sh
fi

The problem with this code is that $USER resolves to the service account that runs the Workspace Server. It works fine if I create a folder for the service account, but I need to look for the user logged in to metadata. Is there a way to do this?

 

I have played around with X commands, %SYSEXEC and the data step statement call system. Because once we get to the SAS Session I can use %mduextr to figure the metadata user out. But it seems that I can not affect the parent process with the new environment variable. Only child processes. So I need to set the variables earlier. 

 

I hope you can help.

 

Best regards

Filip Kildegaard

fkildegaard consult

 

Appendix:

When I start a Workspace session on a machine that is not part of the GRID. I can see that an environment variable called METAUSER is set. I find my session ID in Management Console (it could be 32071) and then I run the following code as root:

 

strings /proc/32071/environ | grep METAUSER

I get the following:

metauser.JPG

 

If I do the same on one of the GRID machines, I don't get the METAUSER environment variables:

metauser2.JPG

 

And from SAS I also get an note that suggests that the variable is missing:

metauser3.JPG

Best regards
Filip Kildegaard
fkildegaard consult

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Discussion stats
  • 0 replies
  • 439 views
  • 0 likes
  • 1 in conversation