#!/bin/bash
#
# This script is used to compress the datacollection logs so that they
# fit on disk better and transfer back to processing machines more
# quickly. It is intended to be run as an occasional cron job during
# datacollection. Eg, install this during a datacollection to gzip
# the last hour logfile 5 minutes after the hour.
#
# 5 * * * * /var/lib/postgresql/bin/gzip-collection

hour=$[$(date +'%H') - 1]
hour=$(printf "%02d" ${hour})
gzip "/var/log/postgresql/datacolection-${hour}.csv"
