In this article, we will discuss the procedure that needs to be performed when our use case scenario requires additional system or user environment variables to be defined for the Agent to perform action(s) properly. This would typically apply when various installations of different applications are highly customized, in this example we will update the system environment variable for PATH.
1. Some background information real quick, there are two special characters that use variables for definition, and they are:
%WRAPPER_PATH_SEPARATOR% = ; (Linux), or : (Windows)
%WRAPPER_FILE_SEPARATOR% = / (Linux), or \ (Windows)
So, in effect, if we want to achieve \tmp or /tmp on Windows/Linux, we would define this as:
%WRAPPER_FILE_SEPARATOR%tmp
2. Also, if there is a variable already defined whether in wrapper.conf or on the system, to re-use this variable in a newly defined one, simply wrap the variable with the '%' sign, to utilize the PATH variable already defined, we would refer to it as %PATH%.
3. To add system environment variables simply edit, within you agent installation directory, the file:
conf\wrapper.conf
4. Add the environment variables in the format per line:
set.VARIABLE=<variable>
eg;
set.MYVARIABLE=testing123
Would effectively define $MYVARIABLE as testing123
Lets say for instance, we need to update the PATH variable for one of our applications to start properly with a service script.
1. In our agent installation directory(Windows or *nix), open/edit the file:
conf/wrapper.conf
2. Next, we will want to define our additional PATH that we would like the Agent to use, while not losing the contents of the system default. Let's say we want to add /tmp to our PATH, to do this, we will want to add a line:
set.PATH=%WRAPPER_FILE_SEPARATOR%tmp%WRAPPER_PATH_SEPARATOR%%PATH%
This would effectively be: PATH=/tmp;$PATH (Linux) PATH=\tmp:%PATH% (Windows)
3. Next, save the file, and restart the agent service for the changes to take effect. You will now have the updated PATH variable to include the tmp directory we defined in wrapper.conf.