Skip to content

Commit

Permalink
Merge pull request #800 from altendky/path_suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky authored Jul 7, 2021
2 parents 3120b36 + 91d7623 commit 3823059
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [unreleased]
### Fixed
### Added
- `path_suffix` option for rsync and rsyncd archive targets.
Allows adding suffixes to the destination path such as to separate original vs. pool plots.
([#800](https://github.com/ericaltendorf/plotman/pull/800))

## [0.5] - 2021-07-07
### Fixed
Expand Down
10 changes: 7 additions & 3 deletions src/plotman/resources/target_definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ target_definitions:
command: rsync
options: --preallocate --remove-source-files --skip-compress plot --whole-file
site_root: null
path_suffix: ""

# The disk space script must return a line for each directory
# to consider archiving to with the following form.
Expand All @@ -24,7 +25,8 @@ target_definitions:
transfer_script: |
#!/bin/bash
set -evx
"${command}" ${options} "${source}" "${destination}"
full_destination=$(realpath --canonicalize-missing "${destination}/${path_suffix}")
"${command}" ${options} "${source}" "${full_destination}/"
transfer_process_name: "{command}"
transfer_process_argument_prefix: "{site_root}"
rsyncd:
Expand All @@ -38,6 +40,7 @@ target_definitions:
host: null
site_root: null
site: null
path_suffix: ""
disk_space_script: |
#!/bin/bash
set -evx
Expand All @@ -49,9 +52,10 @@ target_definitions:
#!/bin/bash
set -evx
echo Launching transfer activity
relative_path=$(realpath --canonicalize-missing --relative-to="${site_root}" "${destination}")
full_destination=$(realpath --canonicalize-missing "${destination}/${path_suffix}")
relative_path=$(realpath --canonicalize-missing --relative-to="${site_root}" "${full_destination}")
url_root="rsync://${user}@${host}:${rsync_port}/${site}"
"${command}" ${options} "${source}" "${url_root}/${relative_path}"
"${command}" ${options} "${source}" "${url_root}/${relative_path}/"
transfer_process_name: "{command}"
transfer_process_argument_prefix: "rsync://{user}@{host}:{rsync_port}/{site}"
# external_script:
Expand Down

0 comments on commit 3823059

Please sign in to comment.