don't die on some critical sync errors, but continue to replicate all the other datasets.

after all is done exit with an error code
This commit is contained in:
Christoph Klaffl 2018-07-30 22:21:14 +02:00
parent 7c68ef5e8f
commit 63eec4994c
No known key found for this signature in database
GPG Key ID: FC1C525C2A47CC28
1 changed files with 15 additions and 6 deletions

21
syncoid
View File

@ -298,8 +298,11 @@ sub syncdataset {
if ($exitcode < 1) { $exitcode = 1; }
return 0;
}
system($synccmd) == 0
or die "CRITICAL ERROR: $synccmd failed: $?";
system($synccmd) == 0 or do {
warn "CRITICAL ERROR: $synccmd failed: $?";
if ($exitcode < 2) { $exitcode = 2; }
return 0;
};
# now do an -I to the new sync snapshot, assuming there were any snapshots
# other than the new sync snapshot to begin with, of course - and that we
@ -359,8 +362,11 @@ sub syncdataset {
if (!$quiet) { print "Resuming interrupted zfs send/receive from $sourcefs to $targetfs (~ $disp_pvsize remaining):\n"; }
if ($debug) { print "DEBUG: $synccmd\n"; }
system("$synccmd") == 0
or die "CRITICAL ERROR: $synccmd failed: $?";
system("$synccmd") == 0 or do {
warn "CRITICAL ERROR: $synccmd failed: $?";
if ($exitcode < 2) { $exitcode = 2; }
return 0;
};
# a resumed transfer will only be done to the next snapshot,
# so do an normal sync cycle
@ -416,8 +422,11 @@ sub syncdataset {
if (!$quiet) { print "Sending incremental $sourcefs\@$matchingsnap ... $newsyncsnap (~ $disp_pvsize):\n"; }
if ($debug) { print "DEBUG: $synccmd\n"; }
system("$synccmd") == 0
or die "CRITICAL ERROR: $synccmd failed: $?";
system("$synccmd") == 0 or do {
warn "CRITICAL ERROR: $synccmd failed: $?";
if ($exitcode < 2) { $exitcode = 2; }
return 0;
};
# restore original readonly value to target after sync complete
# dyking this functionality out for the time being due to buggy mount/unmount behavior