Skip to content

Instantly share code, notes, and snippets.

@jinzhu
Created May 5, 2011 09:53
Show Gist options
  • Save jinzhu/956813 to your computer and use it in GitHub Desktop.
Save jinzhu/956813 to your computer and use it in GitHub Desktop.
gzip script (used for nginx)
#!/bin/sh
cp $1 $1.tmp
## Remove the old gz if there is one
rm -rf $1.gz
## Compress the tmp HTML copy. Use the highest level 9
## compression and do not store dates or file names
## in the gzip header. BTW, if the compressed gz is
## larger then the original file a gzip will NOT be made.
gzip -9 $1.tmp -c > $1.gz
## Clean up any tmp files
rm -rf $1.tmp
echo ""
echo "Verify files"
ls -al $1*
echo ""
echo "Compression statistics"
gzip -vl $1.gz
@jinzhu
Copy link
Author

jinzhu commented May 5, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment