-#!/bin/sh
+#!/bin/bash -e
#
# Rotate query logs.
logfile=`date "+$basedir/../log/query-%F.log.gz"`
# dump the old logfile
-pg_dump -a -F p -t backup_query_log $dbname | gzip -9 > $logfile || exit
+pg_dump -a -F p -t backup_query_log $dbname | gzip -9 > $logfile
# remove the old logs
psql -q -d $dbname -c 'DROP TABLE backup_query_log'