Environment variables

From MCEWiki
Related topics:

Environment variables can be used to alter the behaviour of both MAS and MCE script. All environment variables defined by MAS and MCE script use the prefix MAS_.

Environment variables affecting MAS

Two environment variables affect the operation of MAS itself:

MAS_MAS_CFG

This can be set to specify the path to the default mas.cfg file:

 MAS_MAS_CFG=/home/mce/mas_test/mas.cfg

If this variable is not set, a hard-coded default, determined at build time, is used instead. The hard-coded default is the location into which mas.cfg is installed via MAS's "make install", typically "/etc/mce/mas.cfg". This install location can be changed via the --with-etc-dir= option to the MAS configure script. (See MAS OS setup.)

Note: this only sets the default mas.cfg path. Most MAS applications allow choosing a different mas.cfg at runtime via a command-line option (typically -m) which will override this. As a result, this variable rarely needs to be defined.

MAS_MCE_DEV

When Multicard MAS is enabled, the default logical fibre card can be specified in the environment using the MAS_MCE_DEV variable. It should be an integer, e.g.:

 MAS_MCE_DEV=1

See Using Multicard MAS for examples of its use. This variable is ignored completely if Multicard MAS isn't enabled.

Environment variables affecting MCE script

In addition to the MAS variables above (which affect MCE script indirectly), the following environment variables are used by many programs in the MCE script tree. Except for $MAS_VAR itself, the contents of these variables are also available via the mas_var program (q.v.), and need not be defined for normal operation.

MAS_VAR

The full path to the mas_var program. Typically "/usr/mce/bin/mas_var". Note: because MCE script uses the mas_var specified by this variable, if set, to determine the value of all the other environment variables listed below, changing this to point to a mas_var that is part of a differently configured MAS is a very powerful way to change which version of MAS is used by the MCE scripts.

MAS_BIN

The location of the MAS application binaries, typically "/usr/mce/bin".

MAS_CONFIG

The location of the MCE configuration data, typically "/usr/mce/config".

MAS_DATA_ROOT

The base directory into which MCE data is written. This is the directory containing, among other things, the array_id file. In non-Multicard MAS, the default is "/data/cryo". For Multicard MAS, the default is "/data/mceN" where N is the fibre card number.

MAS_DATA

The specific directory into which MCE data is written. Typically this is "${MAS_DATA_ROOT}/current_data", but there is no requirement for it to be a subdirectory of $MAS_DATA_ROOT.

MAS_ETC

The directory containing the hardware configuration files (ie. mce.cfg for non-Multicard MAS, mceN.cfg for Multicard MAS). Typically "/etc/mce".

Note: by default this is also the directory containing mas.cfg, but this variable is never consulted when deciding where to look for that file. (See MAS_MAS_CFG above if the location of mas.cfg needs to be changed).

MAS_JAM_DIR

The directory containing MCE firmware files for use by mce_fw_update when programming the MCE over fibre (see Remote Firmware Update). Typically "/usr/mce/firmware", although "/usr/mce/mce_script/firmware" is also seen.

MAS_TEMP

A directory used by MCE script for temporary files, mostly mce_cmd scripts. Typically "/tmp".

MAS_ROOT

Perhaps surprisingly, this is specifies the root directory for the MCE script tree and not the MAS installation prefix. Typically "/usr/mce/mce_script".

(The MAS installation prefix (i.e. "/usr/mce") is available via "mas_var --prefix". For convenience it sometimes appears as the environment variable MAS_PREFIX, although neither MAS nor MCE script ever use the MAS_PREFIX variable.)

MCE script subdirectories

The following environment variables refer to various subdirectories of the MCE script tree, usually rooted at $MAS_ROOT. They can all be modified separately to allow finer-grained control in overriding parts of MCE script. They need not point to subdirectories under $MAS_ROOT.

MAS_IDL
the full path to the MCE script IDL files; typically "/usr/mce/mce_script/idl_pro
MAS_PYTHON
the full path to the MCE script python modules; typically "/usr/mce/mce_script/python". Note: this is not the MAS python directory, which is usually "/usr/mce/python".
MAS_SCRIPT
the full path to the MCE script program directory; typically "/usr/mce/mce_script/script".
MAS_TEMPLATE
the full path to the MCE script configuration template directory; typically "/usr/mce/mce_script/template". Note: this also used to be the location of the configuration data itself, although that's usually housed in the $MAS_CONFIG directory these days.
MAS_TEST_SUITE
the path to the MCE script test suite scripts; typically "/usr/mce/mce_script/test_suite".

Modified system variables

Typically to get a MAS system to work properly it is also advisable to modify the system variables $PATH and $PYTHONPATH. Add to $PATH the values of $MAS_BIN, $MAS_SCRIPT, $MAS_TEST_SUITE. Add to $PYTHONPATH the value of $MAS_PYTHON plus the MAS python path (typically "/usr/mce/python"). mas_var can be used to automate this.