---
title: How do I change the PID file directory?
sidebar_label: PID file directory
---

Deephaven uses standard Linux PID (Process ID) files, which are stored by default in the directory `/etc/deephaven/run`.

This guide demonstrates how to change the PID file location. The examples assume that the new directory is `/etc/deephaven/pidfileDir`, so adjust the commands accordingly for the desired directory.

## Change the PID file directory

First, stop all Deephaven processes.

```bash
sudo -u irisadmin monit stop all
```

If necessary, create the new PID file directory (`pidfileDir`, in this case) and ensure that the new PID file directory is writable by irisadmin:dbmergegrp.

```bash
sudo -u irisadmin mkdir /etc/deephaven/pidfileDir
sudo -u irisadmin ls -l /etc/deephaven
sudo -u irisadmin chmod 775 /etc/deephaven/pidfileDir
sudo -u irisadmin touch /etc/deephaven/pidfileDir/testfile
sudo -u irisadmin rm /etc/deephaven/pidfileDir/testfile
```

Update the host configuration to specify the new PID file directory:

```bash
sudo vi /etc/sysconfig/illumon
```

Add an environment variable to the hostconfig file:

```bash
export PIDROOT=/etc/deephaven/pidfileDir
```

Perform the rest of the steps as `irisadmin`.

```bash
sudo su - irisadmin
```

Update the monit files to specify the new location. Some of these files are links (the `auth` and `conf` ones), and any substitute commands must ensure that the backing files are updated rather than adding or replacing them with new files created in the local directory, or upgrades will remove the changes. For example:

```bash
cd /etc/monit.d/deephaven/auth
sed --follow-symlinks  -i -e 's+/etc/deephaven/run+/etc/deephaven/pidfileDir+g' *.conf
cd /etc/monit.d/deephaven/config
sed --follow-symlinks -i -e 's+/etc/deephaven/run+/etc/deephaven/pidfileDir+g' *.conf
cd /etc/monit.d/deephaven/service
sed --follow-symlinks -i -e 's+/etc/deephaven/run+/etc/deephaven/pidfileDir+g' *.conf
```

The `sed` commands are editing the files to replace `/etc/deephaven/run` with the new path.

[Edit `iris-environment.prop`](../../sys-admin/configuration/dhconfig/overview.md#editing-configuration) to add:

```properties
pidFileDirectory=/etc/deephaven/pidfileDir
```

To edit a properties file:

```bash
sudo -u irisadmin /usr/illumon/latest/bin/dhconfig properties export iris-environment.prop --directory /tmp/propfiles --etcd

vi /tmp/propfiles/iris-environment.prop

sudo -u irisadmin /usr/illumon/latest/bin/dhconfig properties import /tmp/propfiles/iris-environment.prop --etcd
```

Reload monit’s configuration and restart it.

```bash
monit reload
monit start all
```

## Related documentation

- [Configuration Tools](../configuration/dhconfig/overview.md)
