Who sets $HOME

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
hsahay
Premium Member
Premium Member
Posts: 175
Joined: Wed Mar 21, 2007 9:35 am

Who sets $HOME

Post by hsahay »

Hi

I need to know who/what sets the $HOME parameter in unix shells spawned by a datastage job.

I have a datastage job that invokes a unix shell script as an after job process. In our setup, "dsadm" is the datastage admin ID and we use a datastage user id of "pbatch".

The datastage job runs under "pbatch" user. But inside the shell script if i echo $HOME, it displays the $HOME of dsadm user.

In my second server, i have one datastage environment with three projects DEV, UT and IT and three users - devusr, utusr and itusr respectively. They all have the same datastage jobs invoking the same unix script. On this server i get the right $HOME in each project. For example if i am running a job in UT project as "utusr" i get the $HOME of utusr. If runnig a job in IT project as itusr, i get the $HOME of itusr.

Just trying to figure out where the difference in the two servers might be. What is affecting the value of $HOME.

I have already checked that $HOME is not being set in the project environment (DSParams) nor in "dsenv".

thanks
vishal
hsahay
Premium Member
Premium Member
Posts: 175
Joined: Wed Mar 21, 2007 9:35 am

found the answer

Post by hsahay »

$HOME is always set by the dsenv script and is the same as the home directory of dsadm or whatever the admin id is. To over-ride it declare a user defined HOME param in DSParams file in the project directory.
vishal
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you double click on any log, you will get the Even Deatail window from which you can ensure, the user id from which the job is been called.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's my understanding that $HOME is set by the general UNIX login script, for example /etc/profile, that is executed by all users.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hsahay
Premium Member
Premium Member
Posts: 175
Joined: Wed Mar 21, 2007 9:35 am

Post by hsahay »

Ray,

I am thrilled that you are answering this post. Now may be we can get to the bottom of this issue. I am still a novice and would really appreciate your help. Let me explain the setup to you again. On our dev server "dsadm" is the datastage admin ID. We have three projects DEV, UT and IT. Datastage jobs move from DEV to UT to IT as they pass through different stages in the life-cycle. Corresponding to each of the project we have three user IDs , devusr, utusr, itusr and three mountpoints /u06 (for dev), /u07 (for UT) and /u08 (for IT) where all the supporting unix scripts are kept. The run time parameters like database name, userid, passwd etc is kept in the .profile of each user. So for example the .profile of devusr points to the dev database. The .profile of utusr points to the ut database.

The unix scripts use the following command to source in the right .profile at run time.

. $HOME/.profile

Now if i login to unix with "utusr" id, the default unix logon script will set the $HOME to /u07 (as defined in etc/passwd ?). Then if i execute any script in /u07/scripts directory it will be able to source in the right .profile from /u07.

However the probelm occurs when we run the script from a datastage job itself. As a before or after job script, for example. We login to director as utusr, run the job, the job invokes the unix script. Inside the unix script if i echo $HOME. It displays the home of "dsadm" user instead of "utusr".

I think this is happening because in the "dsenv" script in /u01/app/product/dsadm/Ascential/DataStage/DSEngine directory, the following command is setting $HOME to the home directory of dsadm.
.......
............
if [ -n "$DSHOME" ] && [ -d "$DSHOME" ]
then
ODBCINI=$DSHOME/.odbc.ini; export ODBCINI
HOME=${HOME:-/}; export HOME
......
.........
...........

I was able to over-ride this setting by declaring a user defined variable HOME in each of the DEV, UT and IT project's DSParam file.

Please let me know if my understanding is correct or majorly flawed. What am i missing ?

Thanks for your help in advance.
vishal
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

No, your explanation is spot on.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can add $HOME as an environment variable to your project and give it an appropriate default for each project. You can then also add that environment variable to a job design and use it where required to override the project default.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply