#!/bin/sh
#
# trafstats_maintenance: Clean up and maintain the database integrity
# 
# Run this once a day from cron, as postgres (or whoever has vacuum 
# permissions on trafstats)

[ -f /etc/trafstats/trafstats.conf ] || exit 0

. /etc/trafstats/trafstats.conf

echo -n "Running vacuum on the database..."
psql $DBNAME -c "VACUUM ANALYZE rawtraffic" >& /dev/null
if [ $? -eq 0 ] 
then
	echo "Done!"
else
	echo "Failed!"
fi	
