Centos7 setting global variable

Hi All,

I have a variable (LD_LIBRARY_PATH) that i'd like to set as a global variable so that if I run a command via a detatched screen session it is still read.

eg commands:

screen -L -dmS $jobName mpirun --report-bindings -H FDSC1P1,FDSC1P2 --bind-to core --map-by core -np $procnum /opt/FDS/FDS6/bin/fds /opt/FDS/shared/$jobName/$filename

I'm also having a problem running this job via PBS scripts and qsub, which I believe is caused by the same missing environment variable.

I had this same problem earlier in an ubuntu system, where I solved it by adding the variable to .bashrc, I've tried that this time but have had no luck. does centos/rhel do something different?

I'm running CentOS Linux release 7.2.1511 (Core)

I've manually added the variable to .bashrc, .bash_profile, /etc/bashrc, /etc/profile

The error I recieve from screen is:
/opt/FDS/FDS6/bin/fds: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory

Any help or ideas would be great! I'm running out of creative ways to search for this problem in google.

Have you tried putting it in /etc/profile.d/

if everything else fails you can try adding cron schedule to source /etc/enviroment from your defined env path on reboot/startup.

*(overall /etc/enviroment is proper place to set global perma paths)

While /etc/environment might be used in Ubuntu for that purpose its not really the proper place for it. /etc/environment is used by pam, it can be used to set global variables but shouldn't, the correct place if you want to use pam would be /etc/security/pam_env.conf. Keep in mind it also uses a different syntax from how you would normally set variables.

The best method I think is to place global variable/scripts in /etc/profile.d/name_of_your_script, its guaranteed not to be overwritten and all files in it are called by /etc/profile

If there's issues with the variable, it might be because its not correct. So it would be good to know what it is your setting exactly.

Thanks for the ideas guys, I ended up fixing it by make/configuring a new version of the software (mpirun).

I did have the variables set in /etc/profile.d/ in a custom file, with no luck.

I had to upgrade some other software (fds) which then required an update of mpirun, for which I used make/configure, instead of using precompiled binaries.

My latest problem is misbehaving ulimits, but that is probably another forum post.

Thanks again though! I would have replied later but I didn't think to check the actual forum, instead waiting for mail notifications.