Skip to content

Instantly share code, notes, and snippets.

@aronwoost
Last active April 27, 2017 11:11

Revisions

  1. aronwoost revised this gist Jan 8, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gziped_sync.sh
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ find public -iname '*.gz' -exec bash -c 'mv $0 ${0/.gz/}' {} \;
    echo "gzipping successful"

    echo "syncing gzipped files"
    s3cmd sync --progress --acl-public --reduced-redundancy --cf-invalidate --verbose --add-header 'Content-Encoding:gzip' public/* s3://$1/ --exclude '*.*' --include '*.html' --include '*.js' --include '*.css'
    s3cmd sync --progress --acl-public --reduced-redundancy --cf-invalidate --verbose --cf-invalidate-default-index --add-header 'Content-Encoding:gzip' public/* s3://$1/ --exclude '*.*' --include '*.html' --include '*.js' --include '*.css'
    echo "syncing gzipped files complete"

    echo "syncing non-gzipped files"
  2. aronwoost created this gist Jan 7, 2014.
    18 changes: 18 additions & 0 deletions gziped_sync.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash

    # compress the files if they aren't
    find public/ -iname '*.html' -exec ./gzip_if_not_gzipped.sh {} \;
    find public/ -iname '*.js' -exec ./gzip_if_not_gzipped.sh {} \;
    find public/ -iname '*.css' -exec ./gzip_if_not_gzipped.sh {} \;

    # change their name back
    find public -iname '*.gz' -exec bash -c 'mv $0 ${0/.gz/}' {} \;
    echo "gzipping successful"

    echo "syncing gzipped files"
    s3cmd sync --progress --acl-public --reduced-redundancy --cf-invalidate --verbose --add-header 'Content-Encoding:gzip' public/* s3://$1/ --exclude '*.*' --include '*.html' --include '*.js' --include '*.css'
    echo "syncing gzipped files complete"

    echo "syncing non-gzipped files"
    s3cmd sync --progress --acl-public --reduced-redundancy --cf-invalidate --verbose public/* s3://$1/ --exclude '*.html' --exclude '*.js' --exclude '*.css'
    echo "syncing non-gzipped files complete"