http://techgage.com/article/enabling_and_testing_ssd_trim_support_under_linux/2
[sysadmin-cookbook] / recepies / apache2 / deflate-test.sh
1 #!/bin/sh
2
3 if [ -z "$1" ] ; then
4         echo "Usage: $0 http://www.example.com/"
5         exit 1
6 else
7         url=$1
8 fi
9
10 time wget $url -O /tmp/foo
11 echo
12 time wget --header="Accept-Encoding: gzip" $url -O /tmp/foo.gz
13 echo
14
15 orig_size=`ls -al /tmp/foo    | awk '{ print $5 }'`
16 comp_size=`ls -al /tmp/foo.gz | awk '{ print $5 }'`
17
18 if [ $comp_size -lt $orig_size ] ; then
19         echo "OK $comp_size < $orig_size";
20 else
21         echo "ERROR: no visible compression benefits"
22 fi
23
24 #ls -al /tmp/foo /tmp/foo.gz