blob: ea1db56983e85565224d6d8fed71d573aad68430 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/bin/bash
. /etc/profile
YEAR=`date +%Y`
LASTYEAR=$(($YEAR - 1))
for DATE in $YEAR $LASTYEAR
do
echo "Compressing log files"
find /var/log/$DATE* -mtime +1 -exec gzip -9 {} \;
echo "Deleting old log files"
find /var/log/$DATE* -mtime +7 -exec rm -rf {} \;
echo "Deleting empty directories"
find /var/log/$DATE* -depth -type d -empty -exec rm -rf {} \;
done
|