openstack-ansible-os_swift/templates/mlocate-crond-daily.sh.j2
Bjoern Teipel db4ad90762 Remove XFS filesystem from the daily mlocate cron job
This fix removes the XFS filesystem from the daily cron job.
It will help to remove unnecessary disk IO due to updatedb/mlocate
swift object indexing inside the /srv/node folders.

Change-Id: I8bfa92003ce06ee4f065663e054cd2d04f458ec6
Closes-Bug: #1572307
2016-04-22 08:11:57 -05:00

22 lines
476 B
Django/Jinja

#! /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