Browse Source

Merge pull request #14 from Fusl/offload-target-list

Offload target list
master
km09 5 years ago
committed by GitHub
parent
commit
e5f60948ba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions
  1. +2
    -0
      config.example.sh
  2. +2
    -2
      offload-one

+ 2
- 0
config.example.sh View File

@@ -31,6 +31,8 @@ IA_ITEM_DATE=$( date +"%Y-%m" )


# offload items to another rsync storage instead of uploading to IA # offload items to another rsync storage instead of uploading to IA
OFFLOAD_TARGET="rsync://somewhere-far-away:portnum/module-name/directory/" OFFLOAD_TARGET="rsync://somewhere-far-away:portnum/module-name/directory/"
# it is also possible to create a list of targets and the offloader will pick one at random and retry others on failure
# simply comment out the line above and put all rsync target urls separated by newline in a file called "offload_targets"


############### ###############
# DIRECTORIES # # DIRECTORIES #


+ 2
- 2
offload-one View File

@@ -36,7 +36,7 @@ function mayicontinue {


mayicontinue mayicontinue


if test -z "${OFFLOAD_TARGET}" && ! cat ./offload_targets 2> /dev/null | grep -E '^rsync://[^/]+/[^/]+'; then
if test -z "${OFFLOAD_TARGET}" && ! cat ./offload_targets 2> /dev/null | grep -qE '^rsync://[^/]+/[^/]+'; then
echo "No valid offload target specified in OFFLOAD_TARGET environment variable or ./offload_targets file, aborting offload" echo "No valid offload target specified in OFFLOAD_TARGET environment variable or ./offload_targets file, aborting offload"
sleep 30 sleep 30
exit 1 exit 1
@@ -82,7 +82,7 @@ do
continue continue
fi fi
echo "Offloading to ${_OFFLOAD_TARGET}/${ITEM}/" echo "Offloading to ${_OFFLOAD_TARGET}/${ITEM}/"
rsync -r --progress --stats --no-owner --no-group --partial --partial-dir .rsync-tmp --no-compress --compress-level 0 "${UPLOADER_WORKING_DIR}/${ITEM}/" "${_OFFLOAD_TARGET}/${ITEM}/"
rsync -r --progress --stats --no-owner --no-group --partial --partial-dir .rsync-tmp --delay-updates --no-compress --compress-level 0 "${UPLOADER_WORKING_DIR}/${ITEM}/" "${_OFFLOAD_TARGET}/${ITEM}/"
result=$? result=$?
if [[ $result -ne 0 ]] if [[ $result -ne 0 ]]
then then


Loading…
Cancel
Save