Browse Source

Added sleep command

master
Drew Short 5 years ago
parent
commit
be546c36bf
  1. 1
      README.md
  2. 13
      assets/out
  3. 2
      tag

1
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.

13
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 "{

2
tag

@ -1 +1 @@
1.3.1
1.4.1
Loading…
Cancel
Save