Skip to content

Commit

Permalink
Merge pull request #18 from weseek/imprv/remove-destination-filename
Browse files Browse the repository at this point in the history
Improvement: remove the destination filename
  • Loading branch information
skomma authored Apr 24, 2019
2 parents 8b82c19 + ebc2895 commit 54b7cd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bin/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ time ${TAR_CMD} ${TAR_OPTS} ${TARBALL_FULLPATH} -C ${DIRNAME} ${BASENAME}

if [ `echo $TARGET_BUCKET_URL | cut -f1 -d":"` == "s3" ]; then
# transfer tarball to Amazon S3
s3_copy_file ${TARBALL_FULLPATH} ${TARGET_BUCKET_URL}${TARBALL}
s3_copy_file ${TARBALL_FULLPATH} ${TARGET_BUCKET_URL}
elif [ `echo $TARGET_BUCKET_URL | cut -f1 -d":"` == "gs" ]; then
gs_copy_file ${TARBALL_FULLPATH} ${TARGET_BUCKET_URL}${TARBALL}
gs_copy_file ${TARBALL_FULLPATH} ${TARGET_BUCKET_URL}
fi

# clean up working files if in cron mode
Expand Down
8 changes: 3 additions & 5 deletions bin/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ TAR_OPTS="jxvf"
DIRNAME=`/usr/bin/dirname ${TARGET}`
BASENAME=`/usr/bin/basename ${TARGET}`
TARBALL_FULLPATH="${TMPDIR}/${TARGET_FILE}"

S3_TARBALL_FULLURL=${TARGET_BUCKET_URL}${TARGET_FILE}
GS_TARBALL_FULLURL=${TARGET_BUCKET_URL}${TARGET_FILE}
TARBALL_FULLURL=${TARGET_BUCKET_URL}${TARGET_FILE}

# check parameters
if [ "x${TARGET_BUCKET_URL}" == "x" ]; then
Expand All @@ -37,9 +35,9 @@ fi

if [ `echo $TARGET_BUCKET_URL | cut -f1 -d":"` == "s3" ]; then
# download tarball from Amazon S3
s3_copy_file ${S3_TARBALL_FULLURL} ${TARBALL_FULLPATH}
s3_copy_file ${TARBALL_FULLURL} ${TARBALL_FULLPATH}
elif [ `echo $TARGET_BUCKET_URL | cut -f1 -d":"` == "gs" ]; then
gs_copy_file ${GS_TARBALL_FULLURL} ${TARBALL_FULLPATH}
gs_copy_file ${TARBALL_FULLURL} ${TARBALL_FULLPATH}
fi

# run tar command
Expand Down

0 comments on commit 54b7cd5

Please sign in to comment.