# How to configure persistent environment variables on the Management Server

## Product
Multi-Domain Security Management, Security Management

## Version
R80.20 (EOS), R80.30 (EOS), R80.40 (EOS), R81 (EOS), R81.10 (EOS), R81.20, R82

## OS
Gaia

## Last Modified
2025-05-14

## Solution

Environment variables might not survive upgrades, and this may cause old issues to reoccur.

This problem was fixed. The fix is included in:

- [Check Point R81](https://support.checkpoint.com/results/sk/sk166715) and higher
- [Jumbo Hotfix Accumulator for R80.40](https://support.checkpoint.com/results/sk/sk165456) starting from Take 53
- [Jumbo Hotfix Accumulator for R80.30](https://support.checkpoint.com/results/sk/sk153152) starting from Take 210
- [Jumbo Hotfix Accumulator for R80.20](https://support.checkpoint.com/results/sk/sk137592) starting from Take 160
- [Jumbo Hotfix Accumulator for R80.10](https://support.checkpoint.com/results/sk/sk116380) starting from Take 278

**Syntax to set an environment variable:**

- To set an environment variable on-the-fly (applies only to the current shell):

```bash
[Expert@HostName]# $MDS_FWDIR/scripts/reload_env_vars.sh -e "<VARIABLE>=<VALUE>"
```
Example:

```bash
[Expert@HostName]# $MDS_FWDIR/scripts/reload_env_vars.sh -e "NGM_QUERY_LIVENESS_OPTIMIZER=1"
```

- To set an environment variable permanently (survives reboot and upgrade):

```bash
[Expert@HostName]# $MDS_FWDIR/scripts/override_server_setting.sh -e <VARIABLE> <VALUE>
```
Example:

```bash
[Expert@HostName]# $MDS_FWDIR/scripts/override_server_setting.sh -e NGM_QUERY_LIVENESS_OPTIMIZER 1
```

**Syntax to unset an environment variable:**

- To unset an environment variable on-the-fly (applies only to the current shell):

```bash
[Expert@HostName]# $MDS_FWDIR/scripts/reload_env_vars.sh -u <VARIABLE>
```
Example:

```bash
[Expert@HostName]# $MDS_FWDIR/scripts/reload_env_vars.sh -u "NGM_QUERY_LIVENESS_OPTIMIZER"
```

- To unset an environment variable that was set permanently (survives reboot and upgrade):
  - For the Management Server versions R82 and higher, or R81.20 Jumbo Hotfix Take 79 and higher, R81.10 Jumbo Hotfix Take 158 or higher:

```bash
    [Expert@HostName]# $MDS_FWDIR/scripts/override_server_setting.sh -u <VARIABLE>
    ```
    Example:

```bash
    [Expert@HostName]# $MDS_FWDIR/scripts/override_server_setting.sh -u "NGM_QUERY_LIVENESS_OPTIMIZER"
    ```

- For all lower Management Server versions:
    1. Back up the current `$MDS_FWDIR/conf/cpmEnvVars.conf` file:
       ```bash
       [Expert@HostName]# cp -v $MDS_FWDIR/conf/cpmEnvVars.conf{,_BKP}
       ```
    2. Edit the current `$MDS_FWDIR/conf/cpmEnvVars.conf` file:
       ```bash
       [Expert@HostName]# vi $MDS_FWDIR/conf/cpmEnvVars.conf
       ```
    3. Remove the line that contains the environment variable.
    4. Save the changes in the file and exit Vi editor.

Notes:
- There is no validation for the values you configure.
- For the variables to survive upgrade you must have this tool on the machine before the upgrade.

## Article Properties

- **Access Level:** General
- **Status:** Approved
- **Date Created:** 2020-03-30
- **Last Modified:** 2025-05-14
