summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
Diffstat (limited to 'abs')
-rw-r--r--abs/core/rsyslog/PKGBUILD4
-rw-r--r--abs/core/rsyslog/log_care.sh22
2 files changed, 14 insertions, 12 deletions
diff --git a/abs/core/rsyslog/PKGBUILD b/abs/core/rsyslog/PKGBUILD
index e8084ea..10ff5fa 100644
--- a/abs/core/rsyslog/PKGBUILD
+++ b/abs/core/rsyslog/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=rsyslog
pkgver=5.8.6
-pkgrel=9
+pkgrel=10
pkgdesc="An enhanced multi-threaded syslogd with a focus on security and reliability"
url="http://www.rsyslog.com/"
arch=('i686' 'x86_64')
@@ -51,4 +51,4 @@ md5sums=('c46db0496066b82faf735bd4222208d7'
'a18bbcbb6ebdaa13a6ec6d9f3d9eb2da'
'1a0cd4530dd5d1439456d5ae230574d9'
'df5cb090691db8640c489981ba3d0798'
- 'f20c660ec9444613df0ad078944b31ec')
+ 'cd39e6edc1fcbbae2093c40c880e0079')
diff --git a/abs/core/rsyslog/log_care.sh b/abs/core/rsyslog/log_care.sh
index b0a774b..ced0f06 100644
--- a/abs/core/rsyslog/log_care.sh
+++ b/abs/core/rsyslog/log_care.sh
@@ -1,14 +1,16 @@
#!/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 {} \;
+
+BackupDir="/var/log/20*-*-*"
+KeepBackups=14
+NumBackups=`ls -d $BackupDir | wc -l`
+
+if [[ $NumBackups > $KeepBackups ]]; then
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
+ numdel=$(($NumBackups-$KeepBackups))
+ rm -rf `ls -d $BackupDir | head -$numdel`
+fi
+
+echo "Compressing log files"
+find $BackupDir -type f -mtime +2 \( ! -iname "*.gz" \) -exec gzip -9 {} \;