Since your cron jobs are run every day and you want to retain 30 versions, this is the same as deleting all incremental backups older than 30 days.
This is possible with rdiff-backup using the
--remove-older-than option specifiying
1M. You can not combine
--remove-older-than with backing up or restoring data in a single command. You will need to add lines to your crontab.
Another caveat is that
--remove-older-than refuses to delete multiple increments at the same time, unless you specify the
--force option. You could try running it once manually with
--force and then let the cron jobs delete one increment each day. This could cause trouble if the cron jobs are not run for whatever reason (such as the server being down). I would include the
--force option in the cron jobs.
Your new crontab could look something like this:
0 0 * * * user rdiff-backup -v9 email@example.com::/var/www/ /mnt/server1/www
0 1 * * * user rdiff-backup -v9 firstname.lastname@example.org::/var/www/ /mnt/server2/www
0 2 * * * user rdiff-backup -v9 email@example.com::/var/www/ /mnt/server3/www
0 3 * * * user rdiff-backup -v9 --remove-older-than 1M --force /mnt/server1/www
20 3 * * * user rdiff-backup -v9 --remove-older-than 1M --force /mnt/server2/www
40 3 * * * user rdiff-backup -v9 --remove-older-than 1M --force /mnt/server3/www
Whether or not you delete the old increments before creating the new backup or at what time you run which job is something you should decide.
To be clear: only the information needed to restore to an incrementally backed-up state earlier than 30 days ago will be removed, not old data that is still present right now or in a more recent incremental backup.
For more information about the
--remove-older-than option you can read the man page:
Remove the incremental backup information in the destination
directory that has been around longer than the given time.
time_spec can be either an absolute time, like "2002-01-04", or
a time interval. The time interval is an integer followed by
the character s, m, h, D, W, M, or Y, indicating seconds, min-
utes, hours, days, weeks, months, or years respectively, or a
number of these concatenated. For example, 32m means 32 min-
utes, and 3W2D10h7s means 3 weeks, 2 days, 10 hours, and 7 sec-
onds. In this context, a month means 30 days, a year is 365
days, and a day is always 86400 seconds.
rdiff-backup cannot remove-older-than and back up or restore in
a single session. In order to both backup a directory and
remove old files in it, you must run rdiff-backup twice.
By default, rdiff-backup will only delete information from one
session at a time. To remove two or more sessions at the same
time, supply the --force option (rdiff-backup will tell you if
--force is required).
Note that snapshots of deleted files are covered by this opera-
tion. Thus if you deleted a file two weeks ago, backed up imme-
diately afterwards, and then ran rdiff-backup with --remove-
older-than 10D today, no trace of that file would remain.
Finally, file selection options such as --include and --exclude
don't affect --remove-older-than.