Setting Environment Variables
APPX offers five levels at which environment variables may be set:
General Environment Variable information can be found at
APPX Environment Variables.
Specific Environment Variables are documented in detail at
Environment Variables List.
Global OS Environment Variables
The "classic" and most general place to set environment variables is at the OS level. In Windows, they are set in the autoexec.bat or System Environment on APPX/Client machine. In UNIX, they are typically set in /etc/profile
Among the BENEFITS are that they are:
- Familiar to APPX veterans
- Convenient if you have a mixture of Telnet and APPX/Client Users
- Easy to verify what the values are by "set | more"
DISADVANTAGES:
- variables tend to end up scattered around
- using a mixture of OS and appx.env variables leaves you with variable settings in any of many different places. This can be hard to debug!
- for non-APPX/Client users, user must log out and log back in again before changes in variable values can take effect
- for APPX/Client users, the WinAppxD System Service must be stopped and restarted, or the NT must be rebooted, before changes in variable values can take effect
- /etc/profile, NT system environment settings, and shared autoexec.bat files.
- convenient if you have a mix of Telnet and APPX/Client users.
- easy to verify variable values with "set |more" at a command prompt.
Per-user OS Environment Variables
-
UNIX's ~/.profile, or Windows non-shared autoexec.bat
-
Not applicable for APPX/Client
-
For variables set on a per-user basis
It is only useful in "shared disk" configurations on Windows, and for UNIX Telnet access to APPX.
Overrides any OS settings.
Also overrides any global appx.env settings.
Startup script or batch files
The next technique for setting APPX-related environment variables, is to do so directly in the script or batch file invoked by system users to start APPX, or invoked by the system to start AppxD.
BENEFIT:
- If the site already maintains a script or batch file, to start APPX, this may be convenient
- Like appx.env, does not require reboots or system logout/logins for changes to take effect, just exiting and re-entering APPX
DISADVANTAGES:
- If you don't already have an APPX startup script or batch file, for some other site-specific purpose, you probably don't want to add one. It's another file to maintain and remember the purpose of.
- Doesn't offer anything beyond appx.env's functionality, if you're not already doing other things in an APPX startup script that need scripting or batch file programming capabilities
- If someone ever runs APPX by invoking APPX.EXE directly, your script's variable settings won't be executed
- Only affects non-APPX/Client users
- Convenient for sites who customize APPX startup by using a batch file
BENEFIT (start-appxd.sh):
DISADVANTAGE (start-appxd.sh):
- site administrators should be careful to back up this file prior to an APPX upgrade in case a new version includes an updated template start-appxd.sh file
AppxD startup script (UNIX only)
- only affects APPX/Client users
- similar to appx.env, allows all variable settings in one file
Global appx.env Environment Variables
The recommended method for setting environment variables is in Global appx.env.
- $APPXPATH/appx.env
- convenient if you have a mix of Telnet and APPX/Client users
- all variables in a single file
Per-user appx.env Environment Variables
Per-user appx.env is not available for APPX/Client users.
It is only useful in "shared disk" configurations on Windows, and for UNIX Telnet access to APPX.
Overrides any OS settings. Also overrides any global appx.env settings.
- ~/appx.env or C:\appx.env
- not applicable for APPX/Client
- for variables set on a per-user basis
Gotchas
Tech support sees various issues related to environment variables come up on a regular basis. Since forewarned is forearmed, here they are.
APPX_PRT_FI_DIR must have trailing slash
Determines where APPX creates report files. Examples in UNIX and Windows:
$ export APPX_PRT_FI_DIR=/tmp/pat/
C:\> set APPX_PRT_FI_DIR=\\server\printfiles\pat\
Make sure path names are valid
For any variable requiring a file or directory pathname, make sure that all directories in the path exist. On UNIX (or when editing appx_print for UniQue), make sure that the case you use in the variable setting matches the actual case of the filename. A mistake here can cause log files to not appear, or APPX to behave incorrectly.
Setting a variable in .profile for a APPX/Client user will have no effect
While a variable set in a UNIX .profile will affect a user's APPX session if they Telnet in to the APPX machine, it won't affect a APPX/Client login. Since we directly start up APPX from APPX/Client, rather than going through a Command Shell as with Telnet, no shell initialization files are processed.
Clicking "Apply" after a change, won't update a running copy of WinAppxD
WinAppxD runs as a system service. As such, the only way to get WinAppxD (and subsequent APPX/Client sessions started from it) to recognize changes in the system environment is to reboot the server.