diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-09-28 07:19:46 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-09-28 07:24:30 +0000 |
commit | 5edcfa2d670fc76bb50839832a6180c9bcd38cd3 (patch) | |
tree | 8701de0b3f3d2dc296e66dbe21e3bc2cd7e38bbf /main/logrotate/logrotate.cron | |
parent | 8c0797b46cf2728c99d1699f25a0cbfc4cde0fb5 (diff) | |
download | aports-5edcfa2d670fc76bb50839832a6180c9bcd38cd3.tar.bz2 aports-5edcfa2d670fc76bb50839832a6180c9bcd38cd3.tar.xz |
main/logrotate: add support for cpulimit
If package cpulimit is installed, then apply the cpulimit specified
in CPULIMIT in /etc/conf.d/logrotate
This helps monitoring software to not trigger high CPU load alarms
when rotating logs.
Diffstat (limited to 'main/logrotate/logrotate.cron')
-rw-r--r-- | main/logrotate/logrotate.cron | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/main/logrotate/logrotate.cron b/main/logrotate/logrotate.cron new file mode 100644 index 000000000..ad7b3da1a --- /dev/null +++ b/main/logrotate/logrotate.cron @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -f /etc/conf.d/logrotate ]; then + . /etc/conf.d/logrotate +fi + +if [ -x /usr/bin/cpulimit ] && [ -n "$CPULIMIT" ]; then + _cpulimit="/usr/bin/cpulimit --limit=$CPULIMIT" +fi + +$_cpulimit /usr/sbin/logrotate /etc/logrotate.conf +EXITVALUE=$? +if [ $EXITVALUE != 0 ]; then + /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" +fi +exit 0 |