#!/bin/bash # ldap and iplanet log management # # Crontab entry (root): # # 30 2 * * * /usr/local/bin/custom_logrotate.sh # Days to keep old logs AGE=60 for log in `find /local/Netscape/iplanet/*/*/logs/ -type f -name access.log.20 \?\?\?\?\?\?\?\?\?\? -o -name errors.20\?\?\?\?\?\?\?\?\?\? -o -name access.20 \?\?\?\?\?\?-\?\?\?\?\?\? -o -name errors.20\*-\*`;do if [ -f "${log}" ];then echo "Compressing $log" gzip -9 $log fi done for del in `find /local/Netscape/iplanet/*/*/logs/ -type f -mtime +${AGE} - name access.\*.gz -o -name errors.\*.gz`;do if [ -f "${del}" ];then echo "Deleting $del (older than $AGE days)" rm -f $del fi done