From: Dobrica Pavlinusic Date: Sun, 30 Jan 2011 17:17:50 +0000 (+0100) Subject: tranfer xferOK to detect errors and run cleanup X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=commitdiff_plain;h=93efae407e03b97af4872e7c84a1d8a47ef5f391;ds=sidebyside tranfer xferOK to detect errors and run cleanup this can be killall par2 or similar command or par dying on us --- diff --git a/bin/BackupPC_ASA_PostArchive_Update b/bin/BackupPC_ASA_PostArchive_Update index e3d022d..1dea094 100755 --- a/bin/BackupPC_ASA_PostArchive_Update +++ b/bin/BackupPC_ASA_PostArchive_Update @@ -38,6 +38,7 @@ my ($opt,$usage) = describe_options( "%c %o", [ 'host|h=s@', "import just host(s)" ], [ 'num|n=s@', "import just backup number(s)" ], +[ 'ok=n', "xferOK", { default => 0 } ], [ 'check|c', "check archives on disk and sync", { default => 1 } ], [ 'debug|d', "debug", { default => 1 } ], [ 'help', "show help" ], @@ -377,7 +378,15 @@ foreach ( 0 .. $#{ $opt->host } ) { my $host = $opt->host->[$_]; my $num = $opt->num->[$_]; - check_archive $host => $num; + if ( ! $opt->ok ) { + warn "ERROR $host $num running cleanup"; + foreach my $path ( glob "$Conf{ArchiveDest}/$host.$num.*" ) { + warn "# rm $path"; + unlink $path || die $!; + } + } else { + check_archive $host => $num; + } }