# Help plugins/localdump/

## 📝 Scripts per databse type

Here are database plugins that can dump and restore types of databases.
They will be sourced by [APPDIR]/localdump.sh and cannot started directly.

* couchdb2.sh - couchdb 2+3 - using cloudant
* couchdb.sh - couchdb1 - using a bash script
* ldap.sh (*) - openLdap - experimantal
* mysql.sh (*) - Mysql/ Mariadb
* pgsql.sh (*) - PostgreSql - using pg_dump
* sqlite.sh - Sqlite sqlite3

## ⚙️ Settings

See settings in `[APPDIR]/jobs/backup.job`:

```text
dir-localdumps = /var/iml-backup
keep-days = 7
```

dir-localdumps configures the target base directory for dumps. Below are subdirectories for the database type.
In those are the dumps containing name of database scheme and a timestamp. All dumps are gzip compressed.

keep-days contains an integer for the days to keep database dumps locally. Older dumps will be removed.

## 📑 Profiles

There are a few ini files in plugins/localdump/profiles/ that autodetect local databases using standard ports,
You can create your own ini files to detect a remote database or container. 
See <https://os-docs.iml.unibe.ch/iml-backup/Configuration/Database.html>


## ✏️ Global vars in plugin scripts

```text
BACKUP_BASEDIR      {string}  base directory for db dumps
BACKUP_DATE         {string}  string with current timestamp; will be part of filename for backups
BACKUP_KEEP_DAYS    {int}     count of days how long to keep db dumps below $BACKUP_BASEDIR
BACKUP_PLUGINDIR    {string}  scripts for supported databases; [APP]/plugins/localdump
BACKUP_SCRIPT       {string}  script name of db service
BACKUP_TARGETDIR    {string}  target directory db dumps of current service; eg. /var/backup/mysql/
SERVICENAME         {string}  name of db service (one of mysql|pgsql|...)
```