Project

General

Profile

Configuration

Global configuration

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.

Here is the default backupninja.conf:

# how verbose to make the logs
# 5 -- Debugging messages     (and below)
# 4 -- Informational messages (and below)
# 3 -- Warnings               (and below)
# 2 -- Errors                 (and below)
# 1 -- Fatal errors           (only)
loglevel = 4

# send a summary of the backup status to
# this email address:
reportemail = root

# if set to 'yes', a report email will be generated
# even if all modules reported success. (default = yes)
reportsuccess = yes

# if set to 'yes', a report email will be generated
# even if there was no error. (default = yes)
reportwarning = yes

#######################################################
# for most installations, the defaults below are good #
#######################################################

# where to log:
logfile = /var/log/backupninja.log

# directory where all the backup configuration files live
configdirectory = /etc/backup.d

# where backupninja handler scripts are found
scriptdirectory = /usr/share/backupninja

# use colors in the log file
usecolors = yes

Backup Actions

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

Databases:
  • .mysql: backup action for safe MySQL dumps.
  • .pgsql: backup action for safe PostgreSQL dumps.
  • .ldap: backup action for safe OpenLdap dumps.
Source Control:
  • .svn: backup action for safe backups of subversion repositories.
  • .trac: backup action for safe backups of trac repositories.
Other:
  • .sys: backup action for general system reports and hardware information.
  • .makecd: backup action for burning backups to CD/DVD or creating ISOs.
  • .sh: run this file as a shell script.
  • .maildir: backup action for slow, incremental rsyncs of tens of thousands of maildirs.
  • .tar: configure the creation of tarballs.
Remote backup:
  • .rsync: backup action for incremental backups with rsync + hard links.
  • .rdiff: backup action for rdiff-backup (incremental backups)
  • .dup: backup action for duplicity (encrypted backups).
  • .wget: backup action for incremental backups with wget + hard links.

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

Order of Processing

The configuration files are processed in alphabetical order. However, it is suggested that you name the config files in "sysvinit style."

For example:

  1. 10-thiswillnotrun.ldap.disabled
  2. 15-runthisfirst.sh
  3. 20-runthisnext.mysql
  4. 90-runthislast.rdiff

Typically, you will put a .rdiff config file last, so that any database dumps you make are included in the filesystem backup. Configurations files which begin with 0 (zero) or end in .disabled are skipped.

Scheduling

By default, each configuration file is processed everyday at 01:00 (1AM). This can be changed by specifying the 'when' option in a backup action's config file or in the global configuration file.

For example:

when = sundays at 02:00
when = 30th at 22
when = 30 at 22:00
when = everyday at 01            <-- the default
when = Tuesday at 05:00
when = hourly

A configuration file will be processed at the time(s) specified by the "when" option. If multiple "when" options are present, then they all apply. If two configurations files are scheduled to run in the same hour, then we fall back on the alphabetical ordering specified above.

Important! The when must occur before any sections in the config file.

It is possible to have multiple copies of backupninja running if the first instance is not finished before the next one starts.

For this reason, if you want to make sure that a particular backup action is processed before another, then you should give them the same "when" value.

For example, suppose a backup action "reallyslow.rdiff" is started at 10:00 and takes five hours to complete. If another action is scheduled at 12:00, it will start running even though reallyslow.rdiff has not finished. On the other hand, if another action is scheduled also for 10:00 (and comes alphabetically after "reallyslow.rdiff"), then it will be run after reallyslow.rdiff finishes, at about 15:00.

These values for 'when' are equivalent:

when = tuesday at 05:30
when = TUESDAYS at 05

These values for 'when' are invalid:

when = tuesday at 2am
when = tuesday at 2
when = tues at 02

File Format

Unless otherwise specified, the config file format is "ini style." Sections are created by using square bracket. Long lines are connected with a backslash.

For example:

# this is a comment

[fishes]
fish = red
fish = blue

[fruit]
apple = yes
pear = no thanks \
  i will not have a pear.