|
|
@ -78,6 +78,7 @@ for destination in $destinations; do |
|
|
|
rclone_args=$(_jq '.args // [] | join(" ")') |
|
|
|
rclone_link=$(_jq '.link // "false"') |
|
|
|
rclone_link_find_filter=$(_jq '.linkFilter // "-maxdepth 1 -type f"') |
|
|
|
rclone_allow_failure=$(_jq '.allowFailure // "false"') |
|
|
|
|
|
|
|
echo "Destination: $rclone_destination" |
|
|
|
echo "Destination subdir file: ${rclone_destination_subdir_file}" |
|
|
@ -86,6 +87,11 @@ for destination in $destinations; do |
|
|
|
echo "Additonal args: ${rclone_args}" |
|
|
|
echo "Generate link: ${rclone_link}" |
|
|
|
echo "Link find filter: ${rclone_link_find_filter}" |
|
|
|
echo "Allow failure: ${rclone_allow_failure}" |
|
|
|
|
|
|
|
if [[ "${rclone_allow_failure}" = "true" ]]; then |
|
|
|
set +e |
|
|
|
fi |
|
|
|
|
|
|
|
rclone_destination_subdir="" |
|
|
|
if [ -n "$rclone_destination_subdir_file" ]; then |
|
|
@ -101,11 +107,21 @@ for destination in $destinations; do |
|
|
|
echo "Target: ${rclone_target}" |
|
|
|
# shellcheck disable=2086 |
|
|
|
rclone copy "${rclone_source}" "${rclone_target}" --size-only --progress --stats=2s ${rclone_args} |
|
|
|
copy_rc=$? |
|
|
|
if [[ "${rclone_allow_failure}" = "true" && $copy_rc -gt 0 ]]; then |
|
|
|
echo "Rclone copy failed. Switching to next destination." |
|
|
|
continue |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ "$rclone_dedupe" == "true" ]]; then |
|
|
|
echo "Running Dedupe for: ${rclone_target}" |
|
|
|
# shellcheck disable=2086 |
|
|
|
rclone dedupe --dedupe-mode "${rclone_dedupe_mode}" "${rclone_target}" --progress --stats=2s ${rclone_args} |
|
|
|
dedupe_rc=$? |
|
|
|
if [[ "${rclone_allow_failure}" = "true" && $dedupe_rc -gt 0 ]]; then |
|
|
|
echo "Rclone dedupe failed. Switching to next destination." |
|
|
|
continue |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ "${rclone_link}" == "true" ]]; then |
|
|
@ -118,10 +134,19 @@ for destination in $destinations; do |
|
|
|
rclone_target_file="${rclone_target}/${remote_file}" |
|
|
|
echo "Generating Link for: ${rclone_target_file}" |
|
|
|
file_link=$(rclone link "${rclone_target_file}") |
|
|
|
link_rc=$? |
|
|
|
if [[ "${rclone_allow_failure}" = "true" && $link_rc -gt 0 ]]; then |
|
|
|
echo "Rclone linking failed. Switching to next target." |
|
|
|
continue |
|
|
|
fi |
|
|
|
file_links+=( "${rclone_target_file}" "${file_link}" ) |
|
|
|
done |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ "${rclone_allow_failure}" = "true" ]]; then |
|
|
|
set -e |
|
|
|
fi |
|
|
|
|
|
|
|
echo "rclone job complete for ${rclone_source} -> ${rclone_target}" |
|
|
|
done |
|
|
|
|
|
|
|