Browse Source

Added the ability to specify the rclone command

master
Drew Short 4 years ago
parent
commit
4ecd69bf67
  1. 9
      README.md
  2. 8
      assets/out
  3. 2
      tag

9
README.md

@ -61,6 +61,12 @@ It's highly recommended to use secrets mangement to avoid storing sensitive cred
* `destination`: Required. A list of destinations to copy files to.
* `dir`: Required. A rclone destination for the files. ex. `remote:some/location`
* `subdir`: Optional. A file that includes additional path information to be appended to the end of destination.
* `command`: Optional. The rclone command to run. Default `copy`
* copy (default)
* copyto (default)
* move
* sync
* `args`: Optional. An array of additional arguments to pass to rclone.
* `dedupe`: Optional. Run `rsync dedupe` after syncing files. Default `false`
* `dedupeMode`: Optional. The dedupe mode to use. Default `newest`. [rclone dedupe](https://rclone.org/commands/rclone_dedupe/)
* skip
@ -71,9 +77,8 @@ It's highly recommended to use secrets mangement to avoid storing sensitive cred
* rename
* `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`
* `args`: Optional. An array of additional arguments to pass to rclone.
* `allowFailure`: Optional. Allow this destination to fail without failing the job. Default `false`
#### Example
```bash

8
assets/out

@ -73,18 +73,20 @@ for destination in $destinations; do
rclone_destination=$(_jq '.dir')
rclone_destination_subdir_file=$(_jq '.subdir // ""')
rclone_command=$(_jq '.command // "copy"')
rclone_args=$(_jq '.args // [] | join(" ")')
rclone_dedupe=$(_jq '.dedupe // "false"')
rclone_dedupe_mode=$(_jq '.dedupeMode // "newest"')
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}"
echo "Command: ${rclone_command}"
echo "Additonal args: ${rclone_args}"
echo "Run dedupe: ${rclone_dedupe}"
echo "Dedupe mode: ${rclone_dedupe_mode}"
echo "Additonal args: ${rclone_args}"
echo "Generate link: ${rclone_link}"
echo "Link find filter: ${rclone_link_find_filter}"
echo "Allow failure: ${rclone_allow_failure}"
@ -106,7 +108,7 @@ for destination in $destinations; do
fi
echo "Target: ${rclone_target}"
# shellcheck disable=2086
rclone copy "${rclone_source}" "${rclone_target}" --size-only --progress --stats=2s ${rclone_args}
rclone ${rclone_command} "${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."

2
tag

@ -1 +1 @@
1.1.0
1.2.0
Loading…
Cancel
Save