Two scripts, pgbench tests
diff --git a/hl_tests/postgres/prepare.sh b/hl_tests/postgres/prepare.sh
old mode 100644
new mode 100755
index 4f81e0d..e7ca3bc
--- a/hl_tests/postgres/prepare.sh
+++ b/hl_tests/postgres/prepare.sh
@@ -1,12 +1,9 @@
 #!/bin/bash
-
-# install postgres
-apt-get update
-apt-get install postgresql postgresql-contrib
-
-# check if postrges cluster created
+set -e
 
 if [ ! -d /etc/postgresql ]; then
+    apt-get update
+    apt-get install -y postgresql postgresql-contrib
     err=$(pg_createcluster 9.3 main --start 2>&1  /dev/null )
     if [ $? -ne 0 ]; then
         echo "There was an error while creating cluster"
@@ -15,6 +12,8 @@
 fi
 
 sed -i 's/^local\s\+all\s\+all\s\+peer/local all all trust/g' /etc/postgresql/9.3/main/pg_hba.conf
-echo "listen_address = '*'" >> /etc/postgresql/9.3/main/postgresql.conf
+sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/9.3/main/postgresql.conf
 
+service postgresql restart
 
+exit 0
\ No newline at end of file
diff --git a/hl_tests/postgres/run.sh b/hl_tests/postgres/run.sh
old mode 100644
new mode 100755
index aaab8f5..132ed97
--- a/hl_tests/postgres/run.sh
+++ b/hl_tests/postgres/run.sh
@@ -1,29 +1,26 @@
 #!/bin/bash
+set -e
 
-CLIENTS=${CLIENTS:-"16 32 48 64 80 96"}
-TRANSACTINOS_PER_CLIENT=${TRANSACTINOS_PER_CLIENT:-"100 200 300 400 500 600 700 800 900 1000"}
-RESULTS_FILE=${RESULTS_FILE:-"results.json"}
+CLIENTS=${CLIENTS:-"4 8"}
+TRANSACTINOS_PER_CLIENT=${TRANSACTINOS_PER_CLIENT:-"1 2"}
 
 
-createdb -O postgres pgbench
-pgbench -i -U postgres pgbench
+sudo -u postgres createdb -O postgres pgbench
+sudo -u postgres pgbench -i -U postgres pgbench
 
-echo "{" > $RESULTS_FILE
 
 for num_clients in $CLIENTS; do
     for trans_per_cl in $TRANSACTINOS_PER_CLIENT; do
         tps_all=''
         for i in 1 2 3 4 5 6 7 8 9 10; do
-            tps=$(pgbench -c $num_clients -n -t $trans_per_cl -j 4 -r -U postgres pgbench |
-            grep "(excluding connections establishing)" | awk {'print $3'})
-            tps_all="$tps_all\n$tps"
+            echo -n "$num_clients $trans_per_cl:"
+            sudo -u postgres pgbench -c $num_clients -n -t $trans_per_cl -j 4 -r -U postgres pgbench |
+            grep "(excluding connections establishing)" | awk {'print $3'}
         done
-        # calculate average and deviation
-        echo "$num_clients $trans_per_cl: " >> $RESULTS_FILE
-        echo -e $tps_all | awk  '{ col=1; array[NR]=$col; sum+=$col; print "col="$col,"sum="sum} END {for(x=1;x<=NR;x++){sumsq+=((array[x]-(sum/NR))^2);} print "[" sum/NR "," sqrt(sumsq/(NR-1)) "], " }' >> $RESULTS_FILE
     done
 done
 
-echo "}" >> $RESULTS_FILE
+sudo -u postgres dropdb pgbench
 
+exit 0