# Setting default $PATH for openPBS jobs

**URL:** <https://community.openpbs.org/t/setting-default-path-for-openpbs-jobs/2804>\
**Category:** Users/Site Administrators\
**Created:** [September 24, 2021, 6:34pm UTC](https://community.openpbs.org/t/setting-default-path-for-openpbs-jobs/2804 "2021-09-24T18:34:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elorenz81](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@elorenz81](https://community.openpbs.org/u/elorenz81)\
**Post date:** [September 24, 2021, 6:34pm UTC](https://community.openpbs.org/t/setting-default-path-for-openpbs-jobs/2804/1 "2021-09-24T18:34:34Z")

</div>

Hello,

I have a question about how environment variables are set when running pbs jobs with openPBS. On one of my clusters it seems that my $PATH and $LD\_LIBRARY\_PATH are set correctly on the nodes, but are not available when I run a job with PBS.

On this cluster, my .pbs file is able to run at the command line after sshing to a compute node, but it will not run when I submit with qsub from the head node because the job cannot find the correct library. Upon further examination, I found that the $PATH and $LD\_LIBRARY\_PATH variables have different values when I echo them from a compute node terminal vs. outputting the values of those variables from a running pbs job.

My question is: how does openPBS set the $PATH and $LD\_LIBRARY\_PATH variables for pbs jobs? I understand that I can set these values manually within my .pbs file or pass them with ‘qsub -v’ but I would like to understand where to configure the default values or where PBS pulls them from (mostly for standardization across my clusters). Did I miss something during openPBS configuration to specify these?

Thank you,  
Eric

---

<div class="post-metadata">

**Author:** ![adarsh](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@adarsh](https://community.openpbs.org/u/adarsh)\
**Post date:** [September 24, 2021, 10:35pm UTC](https://community.openpbs.org/t/setting-default-path-for-openpbs-jobs/2804/2 "2021-09-24T22:35:34Z")

</div>

Please try this, on one of the nodes of your cluster , say node01

1. ssh root@node01 and edit /etc/profile and add the below line to the end of the file  
export TEST=/bin/false

2. as a user run a interactive job as below  
qsub -I -l select=1:ncpus=1:host=node01   
[qsub capital I for icecream -l (for lotus) select=1:ncpus=1:host=node01]  
you get a prompt on that node (node01)  
echo $TEST

---

<div class="post-metadata">

**Author:** ![elorenz81](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@elorenz81](https://community.openpbs.org/u/elorenz81)\
**Post date:** [September 27, 2021, 4:26pm UTC](https://community.openpbs.org/t/setting-default-path-for-openpbs-jobs/2804/3 "2021-09-27T16:26:30Z")

</div>

Hi adarsh,  
Thank you for the response. This cluster passes the test you described: from an interactive job on the node, \<\<echo $TEST\>\> output is \<\</bin/false\>\>.  
So it seems that /etc/profile is executed when I login to the nodes. I also see no differences between /etc/profile on this cluster vs. a properly working cluster (LD\_LIBRARY\_PATH set correctly) or on the node versions of /etc/profile on the two clusters. Any other ideas?

Thanks,  
Eric

---

<div class="post-metadata">

**Author:** ![adarsh](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@adarsh](https://community.openpbs.org/u/adarsh)\
**Post date:** [September 27, 2021, 9:13pm UTC](https://community.openpbs.org/t/setting-default-path-for-openpbs-jobs/2804/4 "2021-09-27T21:13:41Z")

</div>

Thank you Eric on the interactive job / login - spot on

You can use the pbs\_environment file as well  
a. source /etc/pbs.conf ; edit $PBS\_HOME/pbs\_environment and set the variables and restart the pbs services on the compute node  
Refer : 8.9 Paths and Environment Variables in the [https://www.altair.com/pdfs/pbsworks/PBSAdminGuide2021.1.pdf](https://www.altair.com/pdfs/pbsworks/PBSAdminGuide2021.1.pdf)

b. if you have common home directory across the cluster, then the .bashrc would also help , if the variables are populated there

c. some users also use module load ( to change the enviorment )
