summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2012-04-17 17:28:01 (GMT)
committerBritney Fransen <brfransen@gmail.com>2012-04-17 17:28:01 (GMT)
commit7e90d5ceada3bf524d1c1c07019b2f5580db25ce (patch)
tree736a97e62c9b5566efe1b08343abbbe26e847e68
parent72094a3b732f1d00090d8f59e90f73d2ae5f7225 (diff)
downloadlinhes_pkgbuild-7e90d5ceada3bf524d1c1c07019b2f5580db25ce.zip
linhes_pkgbuild-7e90d5ceada3bf524d1c1c07019b2f5580db25ce.tar.gz
linhes_pkgbuild-7e90d5ceada3bf524d1c1c07019b2f5580db25ce.tar.bz2
rsyslog: log_care.sh: remove empty dirs; remove previous year logs and dirs.
-rw-r--r--abs/core/rsyslog/PKGBUILD8
-rw-r--r--abs/core/rsyslog/__changelog1
-rw-r--r--abs/core/rsyslog/log_care.sh17
3 files changed, 14 insertions, 12 deletions
diff --git a/abs/core/rsyslog/PKGBUILD b/abs/core/rsyslog/PKGBUILD
index 0422880..a4fbf81 100644
--- a/abs/core/rsyslog/PKGBUILD
+++ b/abs/core/rsyslog/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=rsyslog
pkgver=5.8.6
-pkgrel=1
+pkgrel=2
pkgdesc="An enhanced multi-threaded syslogd with a focus on security and reliability"
url="http://www.rsyslog.com/"
arch=('i686' 'x86_64')
@@ -13,7 +13,6 @@ makedepends=( 'libmysqlclient' 'gnutls')
optdepends=( 'libmysqlclient: MySQL Database Support'
'gnutls')
backup=('etc/rsyslog.conf' \
- 'etc/logrotate.d/rsyslog'
'etc/conf.d/rsyslog')
conflicts=('syslog-ng')
replaces=('syslog-ng')
@@ -23,7 +22,6 @@ options=('strip' 'zipman' '!libtool')
install=('rsyslog.install')
source=("http://www.rsyslog.com/files/download/rsyslog/rsyslog-$pkgver.tar.gz"
'rsyslog'
- 'rsyslog.logrotate'
'rsyslog.conf.d' 'rsyslog.conf.linhes' log_care.sh)
build() {
@@ -46,13 +44,11 @@ package() {
install -D -m644 $srcdir/${pkgname}.conf.linhes ${pkgdir}/etc/${pkgname}.conf
mkdir -p ${pkgdir}/etc/rsyslog.d/
touch ${pkgdir}/etc/rsyslog.d/empty.conf
- install -D -m644 $srcdir/${pkgname}.logrotate ${pkgdir}/etc/logrotate.d/${pkgname}
install -D -m644 ${srcdir}/${pkgname}.conf.d ${pkgdir}/etc/conf.d/${pkgname}
install -D -m755 ${srcdir}/log_care.sh ${pkgdir}/etc/cron.daily/log_care
}
md5sums=('c46db0496066b82faf735bd4222208d7'
'a18bbcbb6ebdaa13a6ec6d9f3d9eb2da'
- '8065db4bef3061a4f000ba58779f6829'
'1a0cd4530dd5d1439456d5ae230574d9'
'1e4a87a2ffea61c066a0b01fc9392849'
- '5a4719b7283bba9fc497013848bf5c5c')
+ '86a7e28b59ad80998b2163860d5d612a')
diff --git a/abs/core/rsyslog/__changelog b/abs/core/rsyslog/__changelog
new file mode 100644
index 0000000..69aa96c
--- /dev/null
+++ b/abs/core/rsyslog/__changelog
@@ -0,0 +1 @@
+- removed rsyslog.logrotate from PKGBUILD. LH uses log_care.sh as a cron job to maintain logs
diff --git a/abs/core/rsyslog/log_care.sh b/abs/core/rsyslog/log_care.sh
index 4337828..ea1db56 100644
--- a/abs/core/rsyslog/log_care.sh
+++ b/abs/core/rsyslog/log_care.sh
@@ -1,8 +1,13 @@
#!/bin/bash
. /etc/profile
-DATE=`date +%Y`
-echo "compressing log files"
-find /var/log/$DATE* -mtime +1 -exec gzip -9 {} \;
-echo "Deleting older log files"
-find /var/log/$DATE* -mtime +7 -exec rm -rf {} \;
-
+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