[HCoop-Help] Daemon with access to environment variables

Davor Ocelic docelic at hcoop.net
Sat Apr 4 08:19:47 EDT 2009

On Sat, 4 Apr 2009 13:09:55 +0100
Michal <michal at hcoop.net> wrote:

> Hi,
> Thanks for your replay: I've now tried that, but I can't get it to
> work.
> More specifically, my daemon uses a shared library. The location of
> which I have specified in my LD_LIBRARY_PATH / LIBRARY_PATH variable
> (ok, I'm not sure which one is right, so I just set both) It runs fine
> running it directly from the command line in the foreground as a usual
> command. However, with run-in-pagsh I get:
> error while loading shared libraries: libgsasl.so.7: cannot open
> shared object file: No such file or directory
> Also, in my wrapper script I manually echo the value of the variables
> just before my daemon is called. They are set right: it seems like
> they are not 'transferred' into the environment of the daemon.

Right. echo is not a good indicator because within the process it'll
work, but outside of it it's not guaranteed. A variable has to be
exported if you want it to propagate to child processes.

So, do something like:

export VAR1=VAL1

I think this will solve your problem with LD_LIBRARY_PATH as
well. (Btw, the LD_ is the correct one).

Another thing, just to mention, that you can use to 
resolve ld issues is preloading specifically, such as:

LD_PRELOAD=/path/to/libgsasl.so.7 .....

In that case you'd also want to have it immediately preceeding
the command (i.e. LD_PRELOAD=... <command>) and not 
exported with 'export LD_PRELOAD', because then it would
be preloaded for all commands you start from that shell,
which doesn't really hurt, but isn't optimal.

Tell us how it goes.


More information about the HCoop-Help mailing list