Commit Graph

73 Commits

Author SHA1 Message Date
Jerome Charaoui
85f4ea886a rsync: improve initial directory creation
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.
2021-01-06 20:52:32 -05:00
Fabian Raab
a2646868b3 Create path hirarchy of source path automatically in destination
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)
2021-01-06 20:49:44 -05:00
Jerome Charaoui
7c8ba1e71e rsync: improve log msgs, add debug for rsync success 2021-01-06 20:40:05 -05:00
Jerome Charaoui
40a346ff13 rsync: change id_dsa to id_rsa in rsync handler, fixes #11315
Also changed in example config.
2021-01-02 15:56:54 -05:00
Jerome Charaoui
eabda5615c Remove vserver support (fixes #11289)
This is probably completely unused by now, as vservers have been
superseeded by alternative technology for many years already.
2021-01-02 15:27:32 -05:00
Gabriel Filion
5c6c583181 Enable use of ionice for all handlers to alleviate IO load
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.
2020-12-31 02:08:50 -05:00
Silvio Rhatto
3094b04da5 Rsync: check test mode should set proper dest path (#8196) 2014-11-07 15:16:30 -02:00
Silvio Rhatto
89860aa3f6 Rsync: check test mode also in prepare_storage (#8196) 2014-11-07 14:36:25 -02:00
Silvio Rhatto
c649339ba4 Rsync: support for backupninja's test option (#8196) 2014-11-05 11:18:11 -02:00
intrigeri
179eb70b8c Merge remote-tracking branch 'sarava/bug/3003'
Conflicts:
	handlers/rsync.in
2014-05-03 13:24:08 +00:00
intrigeri
9e1d98a253 Merge remote-tracking branch 'sarava/bug/3929' 2014-05-03 13:20:21 +00:00
Silvio Rhatto
b8b8b46fba Solve quoting issue with "su" (debian #683731) (upstream #4019)
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.
2013-10-26 13:18:19 -02:00
intrigeri
80a51a3e64 Do not warn when rsync exits with status 0. 2012-06-29 16:36:54 +02:00
Silvio Rhatto
05f596080d Issue just warnings on non-fatal rsync errors (#3966) 2012-06-20 00:38:23 -03:00
intrigeri
29dcdbae91 Run rsync command-line through a shell, so that single-quotes around excludes are interpreted (Closes: #677410)
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.
2012-06-15 20:30:25 +02:00
intrigeri
1b48bc4444 rsync: stop passing $excludes as a single argument. 2012-06-15 20:27:01 +02:00
intrigeri
f7488968c0 rsync: generate excludes command-line snippet the same way as the duplicity handler does.
The latter has a robust history wrt. dealing with excludes / glob / quoting
etc., let's use that instead of the shiny new sed-based way.
2012-06-15 20:21:09 +02:00
Silvio Rhatto
5b319008da Updating pipefail branch so it can merge with master (#3892) 2012-05-15 10:00:45 -03:00
intrigeri
7c66b699f5 Always use explicit sed's -e.
Hopefully this fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656968#31
and future incarnations of this class of bugs.
2012-05-14 16:30:02 +02:00
Silvio Rhatto
118d7587b6 Changing pipefail just when it's really needed 2012-05-12 21:48:43 -03:00
intrigeri
c522391404 Merge remote-tracking branch 'sarava/bug/3721' 2012-05-13 02:33:37 +02:00
intrigeri
38a0fc572a Merge remote-tracking branch 'sarava/bug/3838' 2012-05-13 02:31:06 +02:00
intrigeri
64b4d1c9f6 Merge remote-tracking branch 'sarava/bug/3840' 2012-05-13 02:29:48 +02:00
intrigeri
8e3981f444 Merge remote-tracking branch 'sarava/bug/3882' 2012-05-13 02:11:27 +02:00
Silvio Rhatto
b7a92b20f8 Fixing typos (#3868) 2012-05-10 21:26:38 -03:00
Silvio Rhatto
fbf25018be Set/restore pipefail to not mess with other scripts (#3892) 2012-05-10 21:03:37 -03:00
Silvio Rhatto
c43bac5911 Ensure that a non-zero rsync exit status is caught by our handler (#3892) 2012-05-10 18:47:11 -03:00
Silvio Rhatto
f2f7e8cdb3 Merge branches 'master' and 'bug/3840' into bug/3840 2012-05-10 18:16:32 -03:00
Silvio Rhatto
5af9b96371 Removing duplicated locking support (#3838) 2012-05-10 17:25:34 -03:00
Silvio Rhatto
ba3e37595d Changing a 'fatal' to a 'warning' on rsync handler.
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.
2012-05-10 17:00:58 -03:00
Silvio Rhatto
bf5ada0f03 Changing remaining 'exit' to 'fatal' at rsync handler (#3721) 2012-05-10 16:53:52 -03:00
Silvio Rhatto
230c96d9d4 Update increment folder date (#3929) 2012-05-09 19:27:46 -03:00
Silvio Rhatto
39bb9e605f Trying additional quoting on excludes (upstream #3882) 2012-04-13 09:58:18 -03:00
Silvio Rhatto
5ea13f4c24 Using @SED@ for #3882 2012-04-13 00:31:03 -03:00
Silvio Rhatto
aa8d0f8648 Quoting $exclude and $excludes and avoiding a for loop on $exclude to not expand wildcards in beforehand (upstream #3882) 2012-04-12 21:29:57 -03:00
Silvio Rhatto
e22107cf09 Validate created date on long_rotation to avoid too many arguments at comparison (upstream #3868) 2012-04-12 20:52:05 -03:00
Silvio Rhatto
29286c7c3e Quoting $starttime (upstream #3868) 2012-04-12 20:52:02 -03:00
Silvio Rhatto
15b92db991 Rsync handler: use the backup start time and not the time the backup was finished (Debian #654192) 2012-02-28 01:00:45 -03:00
Silvio Rhatto
1fda206fa2 Rsync handler: using more debug/warning instead of regular echo (upstream #3840) 2012-02-27 18:47:21 -03:00
Silvio Rhatto
33f330c0a3 Force rsync handler run bash at the remote destination (upstream #3003) 2012-02-27 17:17:56 -03:00
Silvio Rhatto
102c619341 Fixing $rsync_options output when rsync is local (Issue #3001) 2012-02-26 13:51:24 +01:00
intrigeri
a74db16e51 Fix typos. 2012-02-25 14:01:49 +01:00
Silvio Rhatto
dcabf4fe4e Fixing escaping and debug message for remote metadata cleanup (#3727) 2012-01-04 22:48:45 +01:00
Silvio Rhatto
db45b98132 Cleanup orphaned metadata (#3727) 2012-01-04 22:48:41 +01:00
Silvio Rhatto
d680847c37 Abort on rsync error (#3692) 2012-01-01 17:28:14 +01:00
Silvio Rhatto
6933a8724d Fixing metadata rotation 2012-01-01 10:46:15 +01:00
Silvio Rhatto
aaa53a78b2 Allow disabling rotation or setting 2 days as minimum for backup increments in rsync short format (Issue #2107) 2012-01-01 10:45:48 +01:00
Silvio Rhatto
10d67587ef Removing 'exit 1'; using 'fatal' instead (Redmine#3721) 2012-01-01 10:41:16 +01:00
Silvio Rhatto
926152dfa1 Mangle rsync_options just after all other options were evaluated (#3702) 2011-12-31 22:05:50 +01:00
Silvio Rhatto
b89b684c2c Provide a default number of days for the rsync handler 2011-12-31 22:02:29 +01:00