21
21
# The output of rclone command should be shown in a few minuts
22
22
23
23
export RCLONE_S3_PROFILE=
24
- export RCLONE_S3_REGION=
25
- export RCLONE_S3_PROVIDER=
24
+ export RCLONE_S3_REGION=
25
+ export RCLONE_S3_PROVIDER=
26
26
export RCLONE_S3_ENDPOINT=
27
27
export RCLONE_S3_LOCATION_CONSTRAINT=
28
28
export AWS_ACCESS_KEY_ID=
@@ -277,8 +277,21 @@ restore_rclone(){
277
277
278
278
# ## Comparing S3 with local folder
279
279
echo -e " \nRunning Checksum comparison, hit ctrl+c to cancel ... "
280
- rclone check --verbose --exclude=' .froster.md5sum' ${ARCHIVE_FOLDER} ${DIRECTORY_PATH} ${DEPTH}
280
+ rclone check --verbose --exclude=' .froster.md5sum' --exclude= ' Where-did-the-files-go.txt ' ${ARCHIVE_FOLDER} ${DIRECTORY_PATH} ${DEPTH}
281
281
282
+ rclone_checksum_result=$?
283
+
284
+ if [ $rclone_checksum_result -eq 0 ]; then
285
+ echo -e " \nChecksum verification: success"
286
+ echo -e " Download successfull!"
287
+ elif [ $rclone_checksum_result -eq 1 ]; then
288
+ echo " Error: Checksums do not match."
289
+ exit 1
290
+ else
291
+ echo " Error: rclone error code: $rclone_checksum_result ."
292
+ exit 1
293
+ fi
294
+
282
295
# ## After restore we must check if there are any files to untar
283
296
# # Find all tar files and store them in an array
284
297
mapfile -t tar_files < <( find " ${DIRECTORY_PATH} " -type f -name " ${TAR_FILENAME} " )
@@ -297,11 +310,14 @@ restore_rclone(){
297
310
echo " Deleted: $tar_file "
298
311
else
299
312
echo " Failed to extract: $tar_file "
313
+ exit 1
300
314
fi
301
315
# Change back to the original directory
302
316
cd - > /dev/null || return
303
317
done
304
318
cd " $cdir "
319
+
320
+ echo -e " \nRESTORE SUCCESSFULLY COMPLETED!"
305
321
}
306
322
307
323
# #######
0 commit comments