BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bheinsius
Lapis Lazuli | Level 10

Hi,

 

When I login to Linux i see this PATH:

 

[EUROPE\bart.heinsius-b@zew-v-0a2f0b04 ~]$ echo $PATH

/apps/sas/thirdparty/pm/9.1/bin:/apps/sas/thirdparty/pm/9.1/linux2.6-glibc2.3-x86_64/bin:/apps/sas/thirdparty/lsf/9.1/linux2.6-glibc2.3-x86_64/etc:/apps/sas/thirdparty/lsf/9.1/linux2.6-glibc2.3-x86_64/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/bin:/home/bart.heinsius-b/bin

[EUROPE\bart.heinsius-b@zew-v-0a2f0b04 ~]$

 

When I submit x 'echo $PATH > /tmp/path.txt' from a SAS session running as me I see this PATH:

 

[EUROPE\bart.heinsius-b@zew-v-0a2f0b04 ~]$ cat /tmp/path.txt

/oracle/oracle-client/11.2.0.3/client/bin:/oracle/oracle-client/11.2.0.3/client/bin:/usr/bin:/bin

[EUROPE\bart.heinsius-b@zew-v-0a2f0b04 ~]$

 

Why are they different?

 

Regards,

Bart

1 ACCEPTED SOLUTION

Accepted Solutions
bheinsius
Lapis Lazuli | Level 10

I found the actual reason for this problem.

 

The SAS environment on this machine is restarted every morning using a cron scheduled task using something like this:

 

/apps/sas/SASConfig/Lev5/sas.servers stop && /apps/sas/SASConfig/Lev5/sas.servers start

 

At https://unix.stackexchange.com/questions/27289/how-can-i-run-a-cron-command-with-existing-environmen... I read this:

Cron knows nothing about your shell; it is started by the system, so it has a minimal environment. 

 

Changing the cron command to (something like) this fixed the problem:

 

/bin/bash -l -c '/apps/sas/SASConfig/Lev5/sas.servers stop && /apps/sas/SASConfig/Lev5/sas.servers start'

 

the -l (lowercase L) makes bash act as if it had been invoked as a login shell and results in the Object Spawner being started with the full sasinst path.

 

 

View solution in original post

8 REPLIES 8
alexal
SAS Employee

@bheinsius,


It appears that you have you changed PATH in /<SASHome>/SASFoundation/9.4/bin/sasenv_local

Kurt_Bremser
Super User

A SAS session started by the spawner (ie all workspace servers used by EG or SAS Studio) inherits its environment from the spawner; this is usually that of the SAS install user.

nhvdwalt
Barite | Level 11

Do you modify $PATH in any way in <<SASHOME>>/SASFoundation/9.4/binsasenv_local ?

bheinsius
Lapis Lazuli | Level 10

My Object Spawner runs as sasinst.

This is sasinst's path:

 

[sasinst@zew-v-0a2f0b04 bin]$ echo $PATH

/apps/sas/thirdparty/pm/9.1/bin:/apps/sas/thirdparty/pm/9.1/linux2.6-glibc2.3-x86_64/bin:/apps/sas/thirdparty/lsf/9.1/linux2.6-glibc2.3-x86_64/etc:/apps/sas/thirdparty/lsf/9.1/linux2.6-glibc2.3-x86_64/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/bin:/usr/bin:/home/sasinst/bin

[sasinst@zew-v-0a2f0b04 bin]$

 

setenv_local contains these lines:

 

PATH=$ORACLE_HOME/bin:$PATH

export PATH

 

I don't see any other files in <SASHome>/SASFoundation/9.4/bin that modify the PATH:

[sasinst@zew-v-0a2f0b04 bin]$ grep PATH /apps/sas/SASHome/SASFoundation/9.4/bin/* | grep -v LIBRARY_PATH | grep -v SASCFGPATH

/apps/sas/SASHome/SASFoundation/9.4/bin/sasenv_local:PATH=$ORACLE_HOME/bin:$PATH

/apps/sas/SASHome/SASFoundation/9.4/bin/sasenv_local:export PATH

/apps/sas/SASHome/SASFoundation/9.4/bin/sasenv_local.backup.20160216:PATH=$ORACLE_HOME/bin:$PATH

/apps/sas/SASHome/SASFoundation/9.4/bin/sasenv_local.backup.20160216:export PATH

[sasinst@zew-v-0a2f0b04 bin]$

alexal
SAS Employee

@bheinsius,

This is sasinst's path:
[sasinst@zew-v-0a2f0b04 bin]$ echo $PATH

 

Where were those variables defined? Profile or bashrc? Personal or global? How exactly you start the object spawner? From interactive or non-interactive shell?

For me, it seems like you have defined those variables in your personal profile but starting the object spawner in a non-interactive shell.

Kurt_Bremser
Super User

In my case (SAS 9.4 TS1M2 on AIX 7), the PATH retrieved by

filename oscmd pipe "echo $PATH";
data _null_;
infile oscmd;
input;
put _infile_;
run;

in a workspace server session from EG is exactly the same as in the SAS install user's .profile and the same that I get when I do a su - to the SAS install user.

bheinsius
Lapis Lazuli | Level 10

Thanks for your answers and suggestions.

I solved it but i don't know why.

 

I added /usr/local/bin to the PATH setting in /home/sasinst/.bash_profile and restarted the spawner, to see if this would be picked up in the X command shell.

To my surprise I saw that not only /usr/local/bin was added to the path, but the complete path was now available in the X command shell, identical to the path I get in a regular bash shell.

I then removed /usr/local/bin from the PATH setting again and the correct path - now without /usr/local/bin - was still there.

 

It seems not to be caused by restarting the spawner because we do that every morning. Maybe an incorrect CRLF somewhere that got removed after my editing?

 

Like we say in Dutch: vraag niet hoe het kan maar profiteer ervan! (Don't ask why just take advantage of it).

 

bheinsius
Lapis Lazuli | Level 10

I found the actual reason for this problem.

 

The SAS environment on this machine is restarted every morning using a cron scheduled task using something like this:

 

/apps/sas/SASConfig/Lev5/sas.servers stop && /apps/sas/SASConfig/Lev5/sas.servers start

 

At https://unix.stackexchange.com/questions/27289/how-can-i-run-a-cron-command-with-existing-environmen... I read this:

Cron knows nothing about your shell; it is started by the system, so it has a minimal environment. 

 

Changing the cron command to (something like) this fixed the problem:

 

/bin/bash -l -c '/apps/sas/SASConfig/Lev5/sas.servers stop && /apps/sas/SASConfig/Lev5/sas.servers start'

 

the -l (lowercase L) makes bash act as if it had been invoked as a login shell and results in the Object Spawner being started with the full sasinst path.

 

 

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 3045 views
  • 10 likes
  • 4 in conversation