From 7e90d5ceada3bf524d1c1c07019b2f5580db25ce Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Tue, 17 Apr 2012 12:28:01 -0500 Subject: rsyslog: log_care.sh: remove empty dirs; remove previous year logs and dirs. --- abs/core/rsyslog/PKGBUILD | 8 ++------ abs/core/rsyslog/__changelog | 1 + abs/core/rsyslog/log_care.sh | 17 +++++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 abs/core/rsyslog/__changelog 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 -- cgit v0.12