Skip to content
Snippets Groups Projects
Forked from Liberate / backupninja
389 commits behind the upstream repository.
README.md 9.68 KiB
                                      |\_
             B A C K U P N I N J A   /()/
                                     `\|

  a silent flower blossom death strike to lost data.

Backupninja allows you to coordinate system backup by dropping a few simple configuration files into /etc/backup.d/. Most programs you might use for making backups don't have their own configuration file format. Backupninja provides a centralized way to configure and coordinate many different backup utilities.

Features

  • easy to read ini style configuration files
  • you can drop in scripts to handle new types of backups
  • backup actions can be scheduled
  • you can choose when status report emails are mailed to you (always, on warning, on error, never)
  • console-based wizard (ninjahelper) makes it easy to create backup action configuration files
  • passwords are never sent via the command line to helper programs
  • works with Linux-Vservers

Backup types

  • secure, remote, incremental filesytem backup (via rdiff-backup) incremental data is compressed. permissions are retained even with an unpriviledged backup user
  • backup of mysql databases (via mysqlhotcopy and mysqldump)
  • basic system and hardware info
  • encrypted remote backups (via duplicity)
  • backup of subversion repositories

Installation

See the installation documentation.

Options

The following options are available:

  • -h, --help: this usage message
  • -d, --debug: run in debug mode, where all log messages are output to the current shell
  • -f, --conffile FILE: use FILE for the main configuration instead of /etc/backupninja.conf
  • -t, --test: test run mode. This will test if the backup could run, without actually preforming any backups. For example, it will attempt to authenticate or test that ssh keys are set correctly.
  • -n, --now: perform actions now, instead of when they might be scheduled. No output will be created unless also run with -d.
  • --run FILE: runs the specified action FILE (e.g. one of the /etc/backup.d/ files). Also puts backupninja in debug mode.

ninjahelper

ninjahelper is an additional script which will walk you through the process of configuring backupninja. Ninjahelper has a menu driven curses based interface (using dialog).

To add an additional 'wizard' to ninjahelper, follow these steps:

  1. To add a helper for the handler "blue", create the file blue.helper in the directory where the handlers live. (ie /usr/share/backupninja).

  2. Next, you need to add your helper to the global HELPERS variable and define the main function for your helper (the function name is always <helper>_wizard). for example, blue.helper:

        HELPERS="$HELPERS blue:description_of_this_helper"
        blue_wizard() {
          ... do work here ...
        }
  3. Look at the existing helpers to see how they are written. Try to re-use functions, such as the dialog functions that are defined in easydialog.sh, or the vserver functions defined in lib/vserver.

  4. Test, re-test, and test again. Try to break the helper by going backwards, try to think like someone who has no idea how to configure your handler would think, try to make your helper as simple as possible. Walk like a cat, become your shadow, don't let your senses betray you.

Configuration files

The general configuration file is /etc/backupninja.conf. In this file you can set the log level and change the default directory locations. You can force a different general configuration file with backupninja -f /path/to/conf.

To preform the actual backup, backupninja processes each configuration file in /etc/backup.d according to the file's suffix:

  • .sh: run this file as a shell script.
  • .rdiff: filesystem backup (using rdiff-backup)
  • .dup: filesystem backup (using duplicity)
  • .mysql: backup mysql databases
  • .pgsql: backup PostgreSQL databases
  • .sys: general hardware, partition, and system reports.
  • .svn: backup subversion repositories
  • .maildir: incrementally backup maildirs (very specialized)

Support for additional configuration types can be added by dropping bash scripts with the name of the suffix into /usr/share/backupninja.