#!/bin/sh # # This program deletes old syslog files # # Andy Welter # www.the-welters.com # # # TIMELIMIT is used to control how long a file is kept by the system. # every time this script runs, it will delete files that are greater # than the specified number of days. # # TIMELIMIT must start with a "+" in order to function properly. # TIMELIMIT="+14" LOGDIR=/var/adm/syslog DATE=`date +"%y%m%d"` if [ -d $LOGDIR ]; then find $LOGDIR -type f -name '*.log.*' -mtime $TIMELIMIT -exec rm {} \; fi