Created
April 10, 2018 15:39
-
-
Save lovellfelix/efd233e08a77145fc5e3ddade81d29c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# variables for vault name, timestamp, and output file | |
VAULT="sandbox-02" | |
NOW=$(date +%s) | |
IDFILE="archive-ids-${NOW}.json" | |
# make sure we can write the output file | |
touch $IDFILE || exit 1 | |
# upload all tar files in forbackup directory, writing | |
# results to the output file | |
# | |
# the archive-description string in the filename prefixed | |
# with the timestamp. this information may be of great | |
# help when/if we later retrieve the file. | |
for F in /home/myproject/forbackup/*.tar; do | |
echo "# $F" >> $IDFILE | |
aws glacier upload-archive \ | |
--vault-name "$VAULT" \ | |
--account-id - \ | |
--archive-description "${NOW}/$F" \ | |
--body "$F" >> $IDFILE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment