From be546c36bf700d276774f686a84d6e610aebc127 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Sun, 10 May 2020 19:43:16 -0500 Subject: [PATCH] Added sleep command --- README.md | 1 + assets/out | 13 +++++++++++++ tag | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 807c4ff..4f9f17d 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ It's highly recommended to use secrets mangement to avoid storing sensitive cred * `link`: Optional. Create a link to the resource if possible. Default `false` * `linkFilter`: Optional. A find filter on the source directory for files to generate links to. Default `-maxdepth 1 -type f` * `allowFailure`: Optional. Allow this destination to fail without failing the job. Default `false` + * `sleep`: Optional. Sleep for this number of seconds after each Rclone command. Default `null` * `linkDestination`: Optional. Rclone location to store the generated link data. * `linkDestinationSubDir`: Optional. A file that includes additional path information to be appened to the end of the linkDestination. diff --git a/assets/out b/assets/out index 2852822..3a4c351 100644 --- a/assets/out +++ b/assets/out @@ -82,6 +82,7 @@ for destination in $destinations; do rclone_link=$(_jq '.link // "false"') rclone_link_find_filter=$(_jq '.linkFilter // "-maxdepth 1 -type f"') rclone_allow_failure=$(_jq '.allowFailure // "false"') + rclone_sleep=$(_jq '.sleep // ""') echo "Destination: $rclone_destination" echo "Destination subdir file: ${rclone_destination_subdir_file}" @@ -112,6 +113,9 @@ for destination in $destinations; do # shellcheck disable=2086 rclone ${rclone_command} "${rclone_source}" "${rclone_target}" --size-only --progress --stats=2s ${rclone_args} copy_rc=$? + if [[ -n "${rclone_sleep}" ]]; then + sleep ${rclone_sleep} + fi if [[ "${rclone_allow_failure}" = "true" && $copy_rc -gt 0 ]]; then echo "Rclone copy failed. Switching to next destination." continue @@ -122,6 +126,9 @@ for destination in $destinations; do # shellcheck disable=2086 rclone dedupe --dedupe-mode "${rclone_dedupe_mode}" "${rclone_target}" --progress --stats=2s ${rclone_args} dedupe_rc=$? + if [[ -n "${rclone_sleep}" ]]; then + sleep ${rclone_sleep} + fi if [[ "${rclone_allow_failure}" = "true" && $dedupe_rc -gt 0 ]]; then echo "Rclone dedupe failed. Switching to next destination." continue @@ -139,6 +146,9 @@ for destination in $destinations; do echo "Generating Link for: ${rclone_target_file}" file_link=$(rclone link "${rclone_target_file}") link_rc=$? + if [[ -n "${rclone_sleep}" ]]; then + sleep ${rclone_sleep} + fi if [[ "${rclone_allow_failure}" = "true" && $link_rc -gt 0 ]]; then echo "Rclone linking failed. Switching to next target." continue @@ -177,6 +187,9 @@ if (( ${#file_links[@]} )); then fi echo "Link Target: ${rclone_link_target}" rclone copy ${links_json_file} ${rclone_link_target} --progress --stats=2s + if [[ -n "${rclone_sleep}" ]]; then + sleep ${rclone_sleep} + fi fi cat "${links_json_file}" jq -n "{ diff --git a/tag b/tag index 3a3cd8c..347f583 100644 --- a/tag +++ b/tag @@ -1 +1 @@ -1.3.1 +1.4.1