On startup of Wrapper, it sets the following environment variables into its own environment.
These variables can be used within the configuration file
"wrapper.conf"
or by accessing the environment of the JVM or any of its child processes.
-
The WRAPPER_ARCH
variable is set to the name of the architecture for which the currently running Wrapper was built.
-
The WRAPPER_BIN_DIR
variable is set to location of the Wrapper binary on startup.
It can be used to define paths relative to this location
even if the current working directory is modified.
-
The WRAPPER_BITS
variable is set to the 32-bit or 64-bit depth for which the currently running Wrapper was built.
-
The WRAPPER_FILE_SEPARATOR
variable is set to '\' on Windows
and '/' on Linux/Unix platforms, as a file separator.
The variable can be used to set platform independent values
for additional environment variables or properties.
In general it is safe to always use '/'
as a file separator for paths used within Java.
Java is designed to work correctly on all platforms
when '/' is used.
-
The WRAPPER_HOSTNAME and
WRAPPER_HOST_NAME variables
are set to the resolved name of the machine where the Wrapper is currently running.
-
The WRAPPER_JAVA_HOME variable
is set on Windows platforms when the Java command is located using the system registry.
In other cases, it is recommended that a JAVA_HOME variable be set.
-
The WRAPPER_OS variable
is set to the name of the OS for which the currently running Wrapper was built.
| Example: |
wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/%WRAPPER_OS%-%WRAPPER_ARCH%-%WRAPPER_BITS%
|
The example above resolves to the following:
| Windows: |
wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/windows-x86-32
|
| Linux: |
wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/linux-x86-32
|
| Solaris: |
wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/solaris-sparc-32
|
-
The WRAPPER_PATH_SEPARATOR variable is
set to ';' on Windows
and ':' on Linux/Unix platforms.
The variable can be used to build up platform independent paths.
| Example: |
set.PATH=..%WRAPPER_FILE_SEPARATOR%lib%WRAPPER_PATH_SEPARATOR%%PATH%
|
The example above resolves to the following:
| Windows: |
set.PATH=..\lib;%PATH%
|
| Unix: |
set.PATH=../lib:%PATH%
|
-
The WRAPPER_PID variable is
set to the PID of the Wrapper process when it is launched.
It can be used in file names like
the PID file
or log file
to make sure that you get a unique file name
when launching multiple copies of the Wrapper with the same configuration file.
| Example: |
wrapper.logfile=../logs/wrapper-%WRAPPER_PID%.log
|
-
The WRAPPER_RAND_NNNNNN variable is
set to a random number at each location it is used within the Wrapper configuration file.
wrapper.app.parameter.1=mytempfile-%WRAPPER_RAND_NNNNNN%.txt
|
The value is set once when the configuration file is loaded and parsed.
If the value should be set each time a JVM is launched, it is necessary to specify the
wrapper.restart.reload_configuration=TRUE
configuration property to cause the configuration to be reparsed prior
to each JVM invocation.
A different random number will be generated each place that the variable is specified.
If it is necessary to reference the same random number in multiple locations,
please first store the value into a local variable and then reference that as needed.
For example:
set.RNUM=%WRAPPER_RAND_NNNNNN%
wrapper.java.additional.1=-Dtempid=%RNUM%
wrapper.app.parameter.1=mytempfile-%RNUM%.txt
|
Additional formats exist for 1 though 6 digit random numbers:
WRAPPER_RAND_N,
WRAPPER_RAND_NN,
WRAPPER_RAND_NNN,
WRAPPER_RAND_NNNN, and
WRAPPER_RAND_NNNNN.
-
The WRAPPER_TIME_YYYYMMDDHHIISS variable
is set to a timestamp at each location it is used within the Wrapper configuration file.
The time returned is the time that the configuration file is loaded.
The variable will return the same value when referenced multiple times
in the same configuration file.
The following example demonstrates how to generate a timestamped file name
and pass it to the JVM:
wrapper.app.parameter.1=mytempfile-%WRAPPER_TIME_YYYYMMDDHHIISS%.txt
|
The above example results in a value like:
wrapper.app.parameter.1=mytempfile-20090409124532.txt
|
The value is set once when the configuration file is loaded and parsed.
If the value should be set each time a JVM is launched, it is necessary to specify
the wrapper.restart.reload_configuration=TRUE
configuration property to cause the configuration to be reparsed prior to each JVM invocation.
The following additional formats can also be referenced:
WRAPPER_TIME_YYYYMMDD_HHIISS,
WRAPPER_TIME_YYYYMMDDHHII,
WRAPPER_TIME_YYYYMMDDHH, and
WRAPPER_TIME_YYYYMMDD.
-
The WRAPPER_WORKING_DIR variable is set
to the location of the Wrapper binary on startup but will be changed to
reflect the current working directory of the Wrapper.
The working directory of the Wrapper can be changed using the
wrapper.working.dir property.
Be sure to read the documentation as its usage is a bit tricky.