Menu ▾ ▴

#31 Use environment variables in my .conf file under Sun Solaris

v3.0.5
open
5
2004-01-21
2004-01-06
Anonymous
No

Hi, I tried to use environment variables in my
application .conf file, but these vars cannot be resolved
when I start the application.
The platform is Sun Solaris and I use the windows
syntax (%myenvar%) in the .conf file.

The script I use to start my application look like this:

#! /bin/sh
. setenvvars.sh
...
WRAPPER_CMD=${COMMON}/JSW/wrapper
WRAPPER_CONF="${CSRUN}/config/TC_NS.conf"
...

Note that ${COMMON} and ${CSRUN} are set in
setenvvars.sh and work in this script but do not in
my .conf file.

The .conf file looks like this:

...
wrapper.java.library.path.1=%COMMON%/JSW
...

Unfortunately %COMMON% is not filled in here.

Any idea?

Discussion

  • Leif Mortenson

    Leif Mortenson - 2004-01-21
    • assigned_to: nobody --> mortenson
     
  • Leif Mortenson

    Leif Mortenson - 2004-01-21

    Logged In: YES
    user_id=228081

    I do not use Solaris very often and am not totally clear on
    how to answer this.
    If I execute a command like:
    export FOO=Foobar
    at the shell and then run the Wrapper using a wrapper.conf
    file which includes a reference to %FOO% then the variable
    will expand correctly.

    If on the other hand, I attempt to expand a shell variable
    from the script then it does not work. I imagine that this
    is a scoping problem of the variables.

    If I try the same thing on Linux I get the same behavior.
    On Linux, I am able to export the variable in the script and
    then be able to use it in my wrapper.conf file. The export
    command does not work within the shell script on Solaris
    however.

    Most likely a lack of knowledge on my part. The Wrapper is
    simply calling getenv to get the environment variable so if
    it is not visible from the Wrapper, it is mot likely not
    being set into the environment which is being made available
    to the Wrapper.

    I'll try and figure out what is necessary to make this work.

    Cheers,
    Leif

     
  • Eric Sandusky

    Eric Sandusky - 2005-01-03

    Logged In: YES
    user_id=1189603

    I believe I have a similar problem to this bug. Please let me
    know if this is resolved or not.

    I am trying to use the java service wrapper script and conf
    files to run my java class as a daemonized service.
    In /etc/profile I define a variable named
    PRO_COMM_MSG_EXE which points to an executable on the
    local drive.

    Now, when I run my java class from a command line (xterm),
    not using the wrapper, the process runs and finds the
    PRO_COMM_MSG_EXE variable.

    When I run as a service through the wrapper, my java class
    eventually tries to kick off the process, but that process says
    the PRO_COMM_MSG_EXE variable is not set.

    Is the wrapper not able to pass on a system-wide
    environment variable to it's process? I have read all the
    documentation regarding environment variables and did not
    come across anything. My guess is this is a bug similar to
    the above and am wondering if it got resolved.

    Thanks..

     

Log in to post a comment.