# Backing up the rport server

### Backup script

Run the following script from cron to perform a backup of all relevant data needed to recover a rport server.

```bash
#!/bin/sh
# Backup the sqlite databases
cd /var/lib/rport
DBS=*.db
for DB in $DBS;do 
    echo $DB
    sqlite3 $DB ".backup '$DB.backup'"
done
# Pack and compress everything
tar --exclude='*.db' \
  -cvzf /var/backups/rportd-$(date +%Y-%m-%d-%H%M%S).tar.gz \
  /var/lib/rport /etc/rport
```

{% hint style="info" %}
The above script is made for Ubuntu/Debian Linux using the default backup folder `/var/backups`. On RedHat and derivates replace by a different folder where you like to store your backups or create `/var/backups` using `mdkir`.
{% endhint %}

{% hint style="warning" %}
Make sure you copy the created backup file to some remote file server.
{% endhint %}


---

# 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://kb.openrport.io/digging-deeper/server-maintenance/backing-up-the-rport-server.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.
