#!/bin/bash
DAYS_TO_KEEP=$((7 * 86400)) # In seconds
LOG_DIR=/var/lib/glassfishv2/domains/domain1/logs
TODAY=$(date +%s)
for FileName in $(ls ${LOG_DIR}/server.log_*)
do
FileDate=$(stat --printf=%Y ${FileName})
DateDiff=$((TODAY - FileDate))
if [ $DateDiff -gt ${DAYS_TO_KEEP} ]
then
echo Deleting ${FileName} ${FileDate} ${TODAY} ${DateDiff}
rm ${FileName}
fi
done
##END##
Monday, October 4, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment