Skip to content

Instantly share code, notes, and snippets.

@lovellfelix
Created April 10, 2018 15:39
Show Gist options
  • Save lovellfelix/efd233e08a77145fc5e3ddade81d29c8 to your computer and use it in GitHub Desktop.
Save lovellfelix/efd233e08a77145fc5e3ddade81d29c8 to your computer and use it in GitHub Desktop.
#!/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