The code added in the previous commit is only relevant for the mirror
format. With the long format, directories are created correctly in the
rotation routine. For the short format, the directory is initially
created, but only for a local destination, so adding a short snippet to
the rotation routine does it.
Before it was only possible to backup root directories (depth one, eg.
/etc, /var, /usr, …). For example consider the following truncated toy
configuration for rsync:
[general]
mountpoint = /media/
backupdir = backup
[source]
include = /foo/bar
include = /etc
We assume you have prepared the existent but empty base-directory
/media/backup/ at your destination, then against the expectation, the
following error rises:
rsync: mkdir "/media/backup/foo/bar/" failed: No such file or directory (2)
The reason is that rsync will take the files from the folder /foo/bar/
and tries to put them into the ulitmate – and therefore existent –
destination /media/backup/foo/bar. This is not what you would expect,
since the prepared directory /media/backup exists and the application
should create the rest itself.
This Merge Request adds a little script which creates the required
directories in the destination before running rsync. It assumes that
the base-directory already exists, so that not too much directories
are created automatically (could be a mess if you accidentally type the
wrong path)
On some workloads, a process creating backups should not become so
aggressive on resources that it prevents normal activity of a machine
from running. It is especially important when writing to disk.
One way to make backups have less impact on the main workload is to
force backups to a lower ionice level.
With the new ionicelevel configuration, it becomes possible for users to
activate the use of ionice and to define the level within the
best-effort class to better suit their needs.
A fix for debian #677410 on commit 29dcdbae introduces a new issue on wheezy
machines where some rsync_options gets out of the rsync command quotes when
invoked by su.
As reported, running backupninja through `bash -x` shows that the `--delete`
option from the rsync command is not included in the single quote for the `su
-c` command:
nice -n 0 su -c '/usr/bin/rsync -av' --delete '--recursive
--delete-excluded //home/ /tmp/test//home//'
This patch attempt to solve that issue by using the intermediary variable
$command.
When --exclude 'something' is passed directly to rsync without going through
a shell, rsync tries to match a file whose name contains single quotes, which is
definitely not what we want it to do: exclude arguments protected with single
quotes are meant to be passed to a shell.
Using 'warning' and 'return' instead of a fatal at rotate_long if
backuproot doesn't exist. Using a warning ensures that the backup
action can process the other includes and not just exit.