Skip to content

Instantly share code, notes, and snippets.

@glasnt
Created September 10, 2013 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glasnt/6505076 to your computer and use it in GitHub Desktop.
Save glasnt/6505076 to your computer and use it in GitHub Desktop.
Given sufficient s3cmd setup, this script can be used to paste stuff into your bucket.
#! /bin/bash -e
BUCKET="mabucket"
PASTE="paste"
if [ $# -eq 0 ]; then echo "Usage: $0 filename, or -l for list"; exit 1;fi
if [ $1 = "-l" ]; then s3cmd ls s3://$BUCKET/$PASTE/; exit 0; fi
FILENAME=`date +"%s"`
cp $1 /tmp/$FILENAME.txt
s3cmd put -P /tmp/$FILENAME.txt s3://$BUCKET/$PASTE/$FILENAME >/dev/null 2>/dev/null
echo "File $1 pasted to http://$BUCKET/$PASTE/$FILENAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment