Skip to main content

The goal of the project is to simplify backup creation.

Project description

Backup Utils

pipeline status coverage report PyPI - License PyPI PyPI - Python Version Code style: black

The goal of this project is to create a front to a backup program like Borg. Indeed, Borg is a really great tool for backup, but I always write a bash script to specify directories I want to save. I also use Rclone to synchronize my backup to a remote. And finally, I need to backup my database.

There are three steps to backup :

  1. Database export
  2. Archiving
  3. Synchronize

For each step, you can use multiple drivers for multiple tools. Also if something goes wrong, all Exceptions are catches to send a notification.

By default, database export use mysql, archiving borg, and synchronize rclone.

1. Installation

You can use pip

pip install backup-utils

You can build the project yourself:

git clone https://gitlab.com/Oprax/backup-utils.git
cd backup-utils
make build # will produce a `dist/backup_utils.pyz` file

2. Usage

usage: backup_utils.pyz [-h] [-v] [-r] [-n] [-d DIR]

Process some integers.

optional arguments:
  -h, --help         show this help message and exit
  -v, --version      show program's version number and exit
  -r, --run          Create a new backup, default command if no args has given
  -n, --notify       Send a notification to test notifier settings
  -d DIR, --dir DIR  Add a new directory to the backup list, so next run it
                     will be back up

3. Example

backup-utils -d /an/absolute/path -d ./a/relative/path
backup-utils --dir ~/user/path

backup-utils --run # the long one
backup-utils -r # the shortcut
backup-utils # `run` is the default command if there is no argument

4. Configuration

The configuration file is a JSON file store in ~/.config/bak-utils/config.json.

You can see config.example.json to have an example.

Root object:

  • directories: A list of directories to backup, please use --dir command to add a new directory.
  • repo: The directory containing the backup and that will be synchronized to a remote server.
  • backup, sync, database and notifier : are tasks objects.

For each tasks object, the most important key is the driver. backup, sync and database objects has hooks, which execute a shell command.

For the moment there are pre_hook and post_hook which is executed before and after each task.

If there is no database key in the config file, this task will be skipped.

Database task as a backup_directory to specify in which directory, SQL file will be saved.

The other params are depending on the driver. See below for more details.

5. Drivers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backup_utils-1.0.0b0.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

backup_utils-1.0.0b0-py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page