[arch-commits] Commit in logrotate/trunk (PKGBUILD logrotate.cron.daily)
Eric Bélanger
eric at archlinux.org
Mon Jan 9 23:16:23 UTC 2012
Date: Monday, January 9, 2012 @ 18:16:23
Author: eric
Revision: 146385
Add nice support to cron job (close FS#27875)
Modified:
logrotate/trunk/PKGBUILD
logrotate/trunk/logrotate.cron.daily
----------------------+
PKGBUILD | 2 +-
logrotate.cron.daily | 23 ++++++++++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2012-01-09 23:04:40 UTC (rev 146384)
+++ PKGBUILD 2012-01-09 23:16:23 UTC (rev 146385)
@@ -19,7 +19,7 @@
md5sums=('bd2e20d8dc644291b08f9215397d28a5'
'fc8e4e15211d8aefd431d0e2e96223c4'
'462a5f364717461537eb2ae6394ad23e'
- '8e23d5d4cc29b1e055b24df87e355cdc')
+ 'aa8ac8283908b6114483a293adcb650f')
build() {
cd "$srcdir/${pkgname}-${pkgver}"
Modified: logrotate.cron.daily
===================================================================
--- logrotate.cron.daily 2012-01-09 23:04:40 UTC (rev 146384)
+++ logrotate.cron.daily 2012-01-09 23:16:23 UTC (rev 146385)
@@ -1,3 +1,24 @@
#!/bin/sh
-/usr/sbin/logrotate /etc/logrotate.conf
+# 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/sbin/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
+ CMD_LOGROTATE="/usr/bin/ionice -c ${IONICE_CLASS:-2} -n ${IONICE_PRIORITY:-7} ${CMD_LOGROTATE}"
+fi
+
+${CMD_LOGROTATE}
+
+exit 0
More information about the arch-commits
mailing list