# Deploying a module backup

While updating the module to a newer version, the user is suggested an option to make a backup of the previous version. It may be necessary sometimes to roll back to the previous version using these backups.

First, you need to stop the module's service:

```
service itgrix_bx stop 
```

By default, backups are created in the `/opt/itgrix_bx_backups/` directory as a subdirectory named with the module name, date, time and version, e.g. `/opt/itgrix_bx_backups/itgrix_bx-20220829-173241-3.9.3/`.

Inside, there are two folders: `/opt/` and `/etc/`. To restore the module from the backup, you need to replace the current contents of the module directories `/opt/itgrix_bx/` and `/etc/itgrix_bx/` with those from the backup directories.

After replacing the files, set the owner and group (asterisk by default) just in case:

```bash
chown -R asterisk. . /opt/itgrix_bx/

chown -R asterisk. . /etc/itgrix_bx/
```

Next, you need to clear the `/opt/itgrix_bx/state.json` file to prevent the module from re-reading all the calls since the time of the backup:

```bash
>/opt/itgrix_bx/state.json
```

Start the module service. You may need to re-authenticate the module in the portal through the admin panel after that.

```bash
service itgrix_bx start
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.itgrix.com/for-admins/deploying-a-module-backup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
