Skip to content

Commit bff6978

Browse files
author
Victor Machado
committed
s3-restore.sh finished
1 parent 06313df commit bff6978

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

s3-restore.sh

+19-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# The output of rclone command should be shown in a few minuts
2222

2323
export RCLONE_S3_PROFILE=
24-
export RCLONE_S3_REGION=
25-
export RCLONE_S3_PROVIDER=
24+
export RCLONE_S3_REGION=
25+
export RCLONE_S3_PROVIDER=
2626
export RCLONE_S3_ENDPOINT=
2727
export RCLONE_S3_LOCATION_CONSTRAINT=
2828
export AWS_ACCESS_KEY_ID=
@@ -277,8 +277,21 @@ restore_rclone(){
277277

278278
### Comparing S3 with local folder
279279
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}
281281

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+
282295
### After restore we must check if there are any files to untar
283296
## Find all tar files and store them in an array
284297
mapfile -t tar_files < <(find "${DIRECTORY_PATH}" -type f -name "${TAR_FILENAME}")
@@ -297,11 +310,14 @@ restore_rclone(){
297310
echo "Deleted: $tar_file"
298311
else
299312
echo "Failed to extract: $tar_file"
313+
exit 1
300314
fi
301315
# Change back to the original directory
302316
cd - >/dev/null || return
303317
done
304318
cd "$cdir"
319+
320+
echo -e "\nRESTORE SUCCESSFULLY COMPLETED!"
305321
}
306322

307323
########

0 commit comments

Comments
 (0)