6

I have an issue with LSF Platform I cannot wrap my head around.

For scripting reason, I need to check the running/pending jobs with 'bjobs' (and other b***) with a perl script.

For some reason it did not work, and I was able to view the following error message:

lsb_init: Failed in an LSF library call: Unable to open file lsf.conf

Some research on Google and in the manual gave nothing great, I did a little test.

My account (max) is a LSF administrator. Root is a LSF admin as well.

So I switched to root, and tried to launch bjobs, but being max with 'sudo –u max'. Please have a look at these commands:

hn[~]=> whoami
max
hn[~]=> bjobs
No unfinished job found
hn[~]=> su
Password: 
[root@hn max]# whoami
root
[root@hn max]# sudo -u max whoami
max
[root@hn max]# bjobs
No unfinished job found
[root@hn max]# sudo -u max bjobs
lsb_init: Failed in an LSF library call: Unable to open file lsf.conf

How can I correct this?

user1921895
  • 65
  • 1
  • 4

2 Answers2

4

By default LSF will look for lsf.conf in /etc. If its not there, then it will look in the directory in the env variable LSF_ENVDIR.

sudo is probably resetting your environment. Try sudo -i or put

Defaults !env_reset

in your sudoers file.

You could also try something like this

sudo -u max LSF_ENVDIR=$LSF_ENVDIR LSF_SERVERDIR=$LSF_SERVERDIR bjobs
Michael Closson
  • 902
  • 8
  • 13
  • This gave me the hint I needed, thanks. I just echo'd my LSF related environmental variables and then had them export set in the script before calling the jobs. – Scott Rowley Jan 15 '14 at 17:19
0

For anybody scripting around SSH, the two variables above must be explicitly set, either on the command line, as in:

ssh foo@bar.net 'export LSF_ENVDIR=/path/to/lsf/envdir; export LSF_SERVERDIR=/path/to/lsf/serverdir; bsub ...'

or in the file ~/.ssh/environment file (provided that sshd is configured with PermitUserEnvironment yes).

sphakka
  • 457
  • 4
  • 11