Merge "Remove XFS filesystem from the daily mlocate cron job"

This commit is contained in:
Jenkins 2016-04-26 21:16:10 +00:00 committed by Gerrit Code Review
commit bf85beb999
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- The XFS filesystem is excluded from the daily mlocate crond job
in order to conserve disk IO for large IOPS bursts due to
updatedb/mlocate file indexing.

View File

@ -109,3 +109,13 @@
tags:
- swift-dirs
- swift-logs
- name: Configure mlocate for cron.daily
template:
src: "mlocate-crond-daily.sh.j2"
dest: "/etc/cron.daily/mlocate"
mode: "0755"
owner: "root"
group: "root"
tags:
- swift-crond

View File

@ -0,0 +1,21 @@
#! /bin/bash
# {{ ansible_managed }}
set -e
[ -x /usr/bin/updatedb.mlocate ] || exit 0
if which on_ac_power >/dev/null 2>&1; then
ON_BATTERY=0
on_ac_power >/dev/null 2>&1 || ON_BATTERY=$?
if [ "$ON_BATTERY" -eq 1 ]; then
exit 0
fi
fi
# See ionice(1)
if [ -x /usr/bin/ionice ] && /usr/bin/ionice -c3 true 2>/dev/null; then
IONICE="/usr/bin/ionice -c3"
fi
flock --nonblock /run/mlocate.daily.lock $IONICE /usr/bin/updatedb.mlocate --prunefs xfs