#!/bin/sh
# "$Id: cycle-judge,v 1.1 2003/06/19 19:21:12 dan_karrels Exp $"
# Changes: use gzip when present to compress files, and give users the option to control the behaviour
# "Alexander Maassen" <outsider@key2peace.org>
# Fixed cycle-judge so it WORKS!
# "Reed Loden" <reed@redmagnet.com>

# Change the setting below to the location where your judge.log resides without the trailing slash
SRCPATH=/usr/local/pgsql/regproc
# Change the setting below if you want the archived logs somewhere else
DSTPATH=/usr/local/pgsql/regproc/logs

if [ -f $SRCPATH/judge.log ]
then
  if [ -f /bin/gzip ]
  then
    /bin/gzip $SRCPATH/judge.log > $DSTPATH/judge.log.`/bin/date +%Y%m%d`.gz
    /bin/rm $SRCPATH/judge.log.gz
  else
    /bin/mv $SRCPATH/judge.log $DSTPATH/judge.log.`/bin/date +%Y%m%d`
  fi
  touch $SRCPATH/judge.log
else
  echo "No logs found. Aborting..."
fi
