Skip to content

Commit

Permalink
Output the command being executed
Browse files Browse the repository at this point in the history
  • Loading branch information
borkweb committed Feb 17, 2021
1 parent 1ea8f6f commit bec783c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion commands/exists.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ fi

echo "Checking for file existence at s3://${S3_BUCKET}/${FILE} at the ${S3_ENDPOINT}"

the_command="aws s3api head-object --bucket ${S3_BUCKET} --key ${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*"

echo $the_command

# Verify file existence.
sh -c "aws s3api head-object --bucket ${S3_BUCKET} --key ${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*"
sh -c $the_command

# XXX: we are just checking the error code, but should check the result for a 404, and raise error in other cases
if [ $? == 0 ]
Expand Down
6 changes: 4 additions & 2 deletions commands/ls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ if [ -z "$FILE" ]; then
exit 1
fi

echo $ENDPOINT_APPEND
the_command="aws s3 ls s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*"

echo $the_command

# Verify file existence.
output=$(sh -c "aws s3 ls s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*")
output=$(sh -c $the_command)

echo $output

Expand Down
6 changes: 5 additions & 1 deletion commands/rm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ if [ -z "$FILE" ]; then
exit 1
fi

the_command="aws s3 rm s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*"

echo $the_command

# Verify file existence.
output=$(sh -c "aws s3 rm s3://${S3_BUCKET}/${FILE} ${S3_PROFILE} ${ENDPOINT_APPEND} $*")
output=$(sh -c $the_command)

echo $output

Expand Down
6 changes: 5 additions & 1 deletion commands/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

set -e

the_command="aws s3 sync ${SOURCE_DIR:-.} s3://${S3_BUCKET}/${DEST_DIR} ${S3_PROFILE} --no-progress ${ENDPOINT_APPEND} $*"

echo $the_command

# Sync path.
sh -c "aws s3 sync ${SOURCE_DIR:-.} s3://${S3_BUCKET}/${DEST_DIR} ${S3_PROFILE} --no-progress ${ENDPOINT_APPEND} $*"
sh -c $the_command

0 comments on commit bec783c

Please sign in to comment.