#!/usr/bin/env bash

MACHINE=$1
PATH_OLD=$PATH


PATH=/var/lib/postgresql/builds-2/pg-master/bin:$PATH_OLD


cp postgresql-master.conf data/postgresql.conf

pg_ctl -D data stop
pg_ctl -D data -l pg.log start

ps ax > master.ps.log 2>&1

./run2.sh $MACHINE master test > master-$(date +%s).csv


PATH=/var/lib/postgresql/builds-2/pg-patched/bin:$PATH_OLD


cp postgresql-patched.conf data/postgresql.conf

pg_ctl -D data stop
pg_ctl -D data -l pg.log start

ps ax > patched.ps.log 2>&1

./run2.sh $MACHINE patched test > patched-$(date +%s).csv


cp postgresql-patched-limit.conf data/postgresql.conf

pg_ctl -D data stop
pg_ctl -D data -l pg.log start

ps ax > patched-limig.ps.log 2>&1

./run2.sh $MACHINE patched-limit test > patched-limit-$(date +%s).csv

