Index: rdiff-backup.1 =================================================================== RCS file: /sources/rdiff-backup/rdiff-backup/rdiff-backup.1,v retrieving revision 1.78 diff -u -r1.78 rdiff-backup.1 --- rdiff-backup.1 2 Jan 2006 20:29:25 -0000 1.78 +++ rdiff-backup.1 30 Jan 2006 16:39:09 -0000 @@ -201,6 +201,13 @@ .B USERS AND GROUPS section for more information. .TP +.BI "\-\-if-older-than " time_spec +Skip the backup unless the most recent incremental backup is older +than +.IR time_spec . +This can be used in conjunction with cron to easily automate backups +for systems that are not always available. +.TP .BI "\-\-include " shell_pattern Similar to .B \-\-exclude Index: rdiff_backup/Main.py =================================================================== RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/Main.py,v retrieving revision 1.104 diff -u -r1.104 Main.py --- rdiff_backup/Main.py 30 Dec 2005 07:00:32 -0000 1.104 +++ rdiff_backup/Main.py 30 Jan 2006 16:39:09 -0000 @@ -30,6 +30,7 @@ action = None create_full_path = None remote_cmd, remote_schema = None, None +if_older_than_string = None force = None select_opts = [] select_files = [] @@ -44,6 +45,7 @@ def parse_cmdlineoptions(arglist): """Parse argument list and set global preferences""" global args, action, create_full_path, force, restore_timestr, remote_cmd + global if_older_than_string global remote_schema, remove_older_than_string global user_mapping_filename, group_mapping_filename, \ preserve_numerical_ids @@ -69,8 +71,8 @@ "exclude-globbing-filelist-stdin", "exclude-mirror=", "exclude-other-filesystems", "exclude-regexp=", "exclude-special-files", "force", "group-mapping-file=", - "include=", "include-filelist=", "include-filelist-stdin", - "include-globbing-filelist=", + "if-older-than=", "include=", "include-filelist=", + "include-filelist-stdin", "include-globbing-filelist=", "include-globbing-filelist-stdin", "include-regexp=", "include-special-files", "include-symbolic-links", "list-at-time=", "list-changed-since=", "list-increments", @@ -127,6 +129,7 @@ select_files.append(sys.stdin) elif opt == "--force": force = 1 elif opt == "--group-mapping-file": group_mapping_filename = arg + elif opt == "--if-older-than": if_older_than_string = arg elif (opt == "--include" or opt == "--include-special-files" or opt == "--include-symbolic-links"): @@ -329,6 +332,13 @@ backup_set_select(rpin) backup_warn_if_infinite_regress(rpin, rpout) if prevtime: + if if_older_than_string: + try: time = Time.genstrtotime(if_older_than_string) + except Time.TimeException, exc: Log.FatalError(str(exc)) + if time < prevtime: + Log("Previous backup newer than %s, skipping" + % if_older_than_string, 2) + return Time.setprevtime(prevtime) rpout.conn.Main.backup_touch_curmirror_local(rpin, rpout) backup.Mirror_and_increment(rpin, rpout, incdir)