blob: b0a774bc2f18ff1297b4c41eb7b1e1eba24aeda8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/bin/bash
MYTH_RUN_STATUS=1
. /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 +12 -exec rm -rf {} \;
echo "Deleting empty directories"
find /var/log/$DATE* -depth -type d -empty -exec rm -rf {} \;
done
|