title: Create and upload tar.gz to S3 bucket
body: <p>I have a post-receive shell script as such:</p>
  
  <pre><code>#!/bin/bash
  
  TGZNAME=imprv`date +%s`.tar.gz
  TGZPATH=/var/git_out/imprv/
  TGZFULL=$TGZPATH$TGZNAME
  S3BUCKET=my-s3-bucket
  S3PATH=s3://$S3BUCKET/imprv/
  
  git --work-tree=/var/git_out/imprv/imprv --git-dir=/path/to/repositories/imprv/imprv.git checkout -f
  
  echo " - creating tar "$TGZNAME &gt;&gt; /tmp/post-receive.log
  tar -cjf $TGZFULL -C /var/git_out/imprv/imprv .
  echo " - tar.gz created "$TGZFULL &gt;&gt; /tmp/post-receive.log
  
  echo " - Uploading "$TGZFULL" to bucket "$S3PATH$TGZNAME &gt;&gt; /tmp/post-receive.log
  s3cmd put $TGZFULL $S3PATH$TGZNAME --mime-type="application/gzip" &gt;&gt; /tmp/post-receive.log
  echo " - operation complete" &gt;&gt; /tmp/post-receive.log
  </code></pre>
  
  <p>Nothing ends up in my bucket, but the tar file is created, and if I manually enter the s3cmd put command it works fine.</p>
  
  <p>I am tailing the log file, and everything seems to proceed just fine, it sits and waits for the compressed file to be created before moving off to the next echo statement, so it's not trying to put the file before the tar.gz file is created.  Thanks in advance.</p>