summaryrefslogtreecommitdiff
path: root/core/logrotate
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2014-04-16 03:47:45 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2014-04-16 03:47:45 +0000
commitc78a18750fc2b9df6ea94089159f4176a1f9198d (patch)
tree25be357ee503ee66fd716327dd1a9a42d5f8b235 /core/logrotate
parentad45d1982b97faa9372d99e51daa687c7c09de7d (diff)
Wed Apr 16 03:42:20 UTC 2014
Diffstat (limited to 'core/logrotate')
-rw-r--r--core/logrotate/PKGBUILD17
-rw-r--r--core/logrotate/logrotate.conf2
-rwxr-xr-xcore/logrotate/logrotate.cron.daily28
-rw-r--r--core/logrotate/logrotate.service9
-rw-r--r--core/logrotate/logrotate.timer7
5 files changed, 28 insertions, 35 deletions
diff --git a/core/logrotate/PKGBUILD b/core/logrotate/PKGBUILD
index a6cdd75d3..eeb7f37d3 100644
--- a/core/logrotate/PKGBUILD
+++ b/core/logrotate/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 196792 2013-10-19 09:14:49Z pierre $
+# $Id: PKGBUILD 210561 2014-04-14 22:14:38Z thomas $
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgname=logrotate
pkgver=3.8.7
-pkgrel=1
+pkgrel=3
pkgdesc="Rotates system logs automatically"
arch=('i686' 'x86_64')
url="https://fedorahosted.org/logrotate/"
@@ -15,11 +15,12 @@ backup=('etc/logrotate.conf')
source=("https://fedorahosted.org/releases/l/o/logrotate/logrotate-${pkgver}.tar.gz"
'paths.patch'
'logrotate.conf'
- 'logrotate.cron.daily')
+ logrotate.{timer,service})
md5sums=('99e08503ef24c3e2e3ff74cc5f3be213'
'e76526bcd6fc33c9d921e1cb1eff1ffb'
- '86209d257c8b8bc0ae34d6f6ef057c0f'
- 'dd5fd26724274fd9c827eadad60ff4c5')
+ '94dae4d3eded2fab9ae879533d3680db'
+ '287c2ad9b074cb5478db7692f385827c'
+ '85560be5272ed68a88bb77a0a2293369')
build() {
cd "$srcdir/${pkgname}-${pkgver}"
@@ -41,5 +42,9 @@ package() {
install -dm755 "$pkgdir/etc/logrotate.d"
install -Dm644 "$srcdir/logrotate.conf" "$pkgdir/etc/logrotate.conf"
- install -Dm744 "$srcdir/logrotate.cron.daily" "$pkgdir/etc/cron.daily/logrotate"
+
+ install -D -m644 ${srcdir}/logrotate.timer ${pkgdir}/usr/lib/systemd/system/logrotate.timer
+ install -D -m644 ${srcdir}/logrotate.service ${pkgdir}/usr/lib/systemd/system/logrotate.service
+ install -d -m755 ${pkgdir}/usr/lib/systemd/system/multi-user.target.wants
+ ln -s ../logrotate.timer ${pkgdir}//usr/lib/systemd/system/multi-user.target.wants/logrotate.timer
}
diff --git a/core/logrotate/logrotate.conf b/core/logrotate/logrotate.conf
index 9c1927fec..4193a3a7f 100644
--- a/core/logrotate/logrotate.conf
+++ b/core/logrotate/logrotate.conf
@@ -26,7 +26,7 @@ include /etc/logrotate.d
/var/log/wtmp {
monthly
create 0664 root utmp
- minsize 1M
+ minsize 1M
rotate 1
}
diff --git a/core/logrotate/logrotate.cron.daily b/core/logrotate/logrotate.cron.daily
deleted file mode 100755
index 11fe09c52..000000000
--- a/core/logrotate/logrotate.cron.daily
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# nicenesses range from -20 (most favorable scheduling) to 19 (least favorable)
-NICE=19
-
-# 0 for none, 1 for real time, 2 for best-effort, 3 for idle
-IONICE_CLASS=2
-
-# 0-7 (for IONICE_CLASS 1 and 2 only), 0=highest, 7=lowest
-IONICE_PRIORITY=7
-
-CMD_LOGROTATE="/usr/bin/logrotate /etc/logrotate.conf"
-
-if [ -x /usr/bin/nice ]; then
- CMD_LOGROTATE="/usr/bin/nice -n ${NICE:-19} ${CMD_LOGROTATE}"
-fi
-
-if [ -x /usr/bin/ionice ]; then
- IONICE_CMD="/usr/bin/ionice -c ${IONICE_CLASS:-2}"
- if [ $IONICE_CLASS -ne 3 ]; then
- IONICE_CMD="${IONICE_CMD} -n ${IONICE_PRIORITY:-7}"
- fi
- CMD_LOGROTATE="${IONICE_CMD} ${CMD_LOGROTATE}"
-fi
-
-${CMD_LOGROTATE}
-
-exit 0
diff --git a/core/logrotate/logrotate.service b/core/logrotate/logrotate.service
new file mode 100644
index 000000000..3a483c3a3
--- /dev/null
+++ b/core/logrotate/logrotate.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Rotate log files
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/logrotate /etc/logrotate.conf
+Nice=19
+IOSchedulingClass=best-effort
+IOSchedulingPriority=7
diff --git a/core/logrotate/logrotate.timer b/core/logrotate/logrotate.timer
new file mode 100644
index 000000000..a92ba1ecc
--- /dev/null
+++ b/core/logrotate/logrotate.timer
@@ -0,0 +1,7 @@
+[Unit]
+Description=Daily rotation of log files
+
+[Timer]
+OnCalendar=daily
+AccuracySec=12h
+Persistent=true