On a Solaris 8 machine, I'm trying to execute a shell script on an NFS
mount which belongs to a user specified in an NIS map. The local shell
script that invokes it goes something like this:

su - theuser -c "/path/to/script" >> logfile > 2>&1 &

This script at /path/to/script (a bash script) depends on some
environment variables that belong to 'theuser.' Unfortunately, they
don't seem to be getting set. The default shell for the user 'theuser'
is bash, and the home directory is correctly specified.

Additionally, if I just do 'su -l theuser' I can see all the correct
environment variables getting set. Following this su by a 'cd,' I go to
the correct NFS home directory, which I would expect since the
environment variables were set properly at this point. Just for
reference, two Linux machines (FC3 and Ubuntu 5.10) happily run this
command as expected, getting all the proper enviroment variables.

The Sun man pages claim this should work, but I just can't seem to get
it to. I'm sure I am missing something simple, but I have run out of
ideas. Does anyone have any ideas what I may be doing wrong?

[email]jhosteny@gmail.com[/email] wrote:[color=blue]
>
> Hi all,
>
> On a Solaris 8 machine, I'm trying to execute a shell script on an NFS
> mount which belongs to a user specified in an NIS map. The local shell
> script that invokes it goes something like this:
>
> su - theuser -c "/path/to/script" >> logfile > 2>&1 &
>
> This script at /path/to/script (a bash script) depends on some
> environment variables that belong to 'theuser.' Unfortunately, they
> don't seem to be getting set. The default shell for the user 'theuser'
> is bash, and the home directory is correctly specified.
>
> Additionally, if I just do 'su -l theuser' I can see all the correct
> environment variables getting set. Following this su by a 'cd,' I go to
> the correct NFS home directory, which I would expect since the
> environment variables were set properly at this point. Just for
> reference, two Linux machines (FC3 and Ubuntu 5.10) happily run this
> command as expected, getting all the proper enviroment variables.
>
> The Sun man pages claim this should work, but I just can't seem to get
> it to. I'm sure I am missing something simple, but I have run out of
> ideas. Does anyone have any ideas what I may be doing wrong?[/color]

which indicates that the command has picked up the right shell for the
user, is running in my home directory, and that the REBUILD variable
exclusive to my environment is being set. What happens if you try
something like that in your case? And what happens if you omit the
background & at the end?