I need to execute an external command in a sequence, where that external command needs a number of environment variables set.
From what I can deduce, the Execute Command stage executes the external command in the Bourne shell (sh). Since my environment files use the bash syntax, I need to also spawn a bash process.
My test sequence program has this command:
Code: Select all
/usr/bin/bash --login -c "env | sort"
This command works fine in a Putty session; I login (bash), unset a few variables, invoke the Bourne shell (sh), then execute the above. I get the necessary environment variables.
When I run this in DS, I don't get the environment variables in the DS log, only the environment variables set in the DS Administrator console.
Finally, I ran this same process using "at now" to run it in true batch mode, just to ensure that bash --login sourced my login files.
I can get this to work by directly sourcing the login files from the Execute Command stage, i.e.
Code: Select all
/usr/bin/bash --login -c "~my_userid/.bash_profile ; env | sort"
I did notice that $HOME=/ (which was unexpected) but $LOGNAME=<my userid>. Does DS launch its processes under some sort of proxy user, then sudo to the client login userid?
Thus
Code: Select all
/usr/bin/bash --login -c "~/.bash_profile ; env | sort"
Any ideas?
Thanks,
Scott