Listing 1: purge_logs.sh 

#!/bin/sh
# purge_logs.sh - compresses, truncates, and deletes old logs
# Bob Apthorpe <apthorpe@excitecorp.com>
#
# compress all logs older than 7 days
/bin/find /excite/daemon/logs -name "*.log" -type f -mtime +7 -print | \
/bin/xargs -i /bin/gzip -9 {} ;
#
# delete compressed logs after a month
/bin/find /excite/daemon/logs -name "*.log.gz" -type f -mtime +28 -print | \
/bin/xargs -i /bin/rm {} ;
#
# truncate 'live' logs - sqlnet.log files are never rotated and it's
# disruptive to shut down a daemon just to rotate logs. Consult your local
# Oracle administrator for ways to prevent these logs from being createdi
# in the first place.
#
/bin/cat /dev/null >> /excite/dbapp/sqlnet.log ;
#
# __END__

