#!/bin/sh

# terracotta client and server logs are under this directory.
tcdir="/usr/local/shibboleth-idp/cluster"

# Log directories to clean.
# Note that Apache logs are handled by logrotate.
tclogdirs="$tcdir/client/logs-127.0.0.1 $tcdir/server/logs"
dirs="/usr/local/tomcat/logs /usr/local/shibboleth-idp/logs $tclogdirs"

# Files older than this number of days will be purged.
days=100

# Purge old files.  We skip dotfiles so as not to nuke terracotta's
# lock files.
for d in $dirs ; do
  find $d -type f \! -name .\* -mtime +$days -exec rm -f {} \;
done

exit 0
