1

I am currently in the process of configuring Open Grid Scheduler in FreeBSD. As part of this process I need to set the environmental variableSGE_ROOTas root.

To do this I have been experimenting with attempting to set this value through the root account's ~/.profile since this account has been configured to use the Bourne shell as it's default shell. I have exported SGE_ROOT as follows: export SGE_ROOT="/usr/local/sge"

However upon logging into the root shell with SGE_ROOT configured in it's ~/.profile it would seem that this method of setting the environment variable doesn't work since running the command env returns the following:

SUDO_COMMAND=/usr/bin/su
LOGNAME=root
MAIL=/var/mail/root
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/ec2-user/bin:/usr/local/sge/bin/fbsd-amd64
SUDO_GID=1001
PWD=/usr/home/ec2-user
TERM=xterm
HOME=/root
USER=root
SHELL=/bin/sh
SUDO_USER=ec2-user
SUDO_UID=1001
USERNAME=root

I do however notice that the PATH variable which I have also configured via root's ~/.profile to include the Open Grid Scheduler binaries would seem to have been successfully set.

I have also found that performing the same configuration in non-root accounts on the same machine succeeds in setting the environmental variable. In addition, exporting the value in the global /etc/profile seems to produce the same behaviour.

I am therefore wondering if perhaps there is a better way of setting this variable for the root account under the Bourne shell?

I understand that it would probably be easier to use tcsh as root's default shell, as this is typically how FreeBSD is configured. However I have thus far had to compile Open Grid Scheduler without support for tcsh due to issues with utmp.h no longer being available in FreeBSD.

1 Answers1

0

I notice that you have SUDO environment variables, so I assume you are running this by using sudo. To test, I set my root user's shell to /bin/sh and added

SGE_ROOT="/usr/local/sge"

export SGE_ROOT

to my /root/.profile

And I don't see the environment variable if I simply run "sudo sh", but I do have it if I run "sudo -i" or "sudo su -" so it seems like the issue has more to do with the way sudo is used than the shell.

Steve Wills
  • 685
  • 3
  • 6