diff --git a/.etckeeper b/.etckeeper index 370561d6..5aee3c05 100755 --- a/.etckeeper +++ b/.etckeeper @@ -169,6 +169,7 @@ maybe chmod 0755 'cron.daily/bsdmainutils' maybe chmod 0755 'cron.daily/dpkg' maybe chmod 0755 'cron.daily/etckeeper' maybe chmod 0755 'cron.daily/exim4-base' +maybe chmod 0755 'cron.daily/locate' maybe chmod 0755 'cron.daily/logrotate' maybe chmod 0755 'cron.daily/man-db' maybe chmod 0755 'cron.daily/passwd' diff --git a/alternatives/locate b/alternatives/locate new file mode 120000 index 00000000..76a3a90a --- /dev/null +++ b/alternatives/locate @@ -0,0 +1 @@ +/usr/bin/locate.findutils \ No newline at end of file diff --git a/alternatives/locate.1.gz b/alternatives/locate.1.gz new file mode 120000 index 00000000..e639008f --- /dev/null +++ b/alternatives/locate.1.gz @@ -0,0 +1 @@ +/usr/share/man/man1/locate.findutils.1.gz \ No newline at end of file diff --git a/alternatives/updatedb b/alternatives/updatedb new file mode 120000 index 00000000..9d1bdccf --- /dev/null +++ b/alternatives/updatedb @@ -0,0 +1 @@ +/usr/bin/updatedb.findutils \ No newline at end of file diff --git a/alternatives/updatedb.1.gz b/alternatives/updatedb.1.gz new file mode 120000 index 00000000..1a257e4e --- /dev/null +++ b/alternatives/updatedb.1.gz @@ -0,0 +1 @@ +/usr/share/man/man1/updatedb.findutils.1.gz \ No newline at end of file diff --git a/cron.daily/locate b/cron.daily/locate new file mode 100755 index 00000000..d2569add --- /dev/null +++ b/cron.daily/locate @@ -0,0 +1,72 @@ +#! /bin/sh + +set -e + +# cron script to update the `locatedb' database. +# +# Written by Ian A. Murdock and +# Kevin Dalley + +# Please consult updatedb(1) and /usr/share/doc/locate/README.Debian + +[ -e /usr/bin/updatedb.findutils ] || exit 0 + +if [ "$(id -u)" != "0" ]; then + echo "You must be root." + exit 1 +fi + +# Global options for invocations of find(1) +FINDOPTIONS='-ignore_readdir_race' +# filesystems which are pruned from updatedb database +PRUNEFS="NFS nfs nfs4 afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre_lite tmpfs usbfs udf ocfs2" +# paths which are pruned from updatedb database +PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /amd /alex /var/spool /sfs /media /var/lib/schroot/mount" +# netpaths which are added +NETPATHS="" +# run find as this user +LOCALUSER="nobody" +# cron.daily/find: run at this priority -- higher number means lower priority +# (this is relative to the default which cron sets, which is usually +5) +NICE=10 + +# I/O priority +# 1 for real time, 2 for best-effort, 3 for idle ("3" only allowed for root) +IONICE_CLASS=3 +# 0-7 (only valid for IONICE_CLASS 1 and 2), 0=highest, 7=lowest +IONICE_PRIORITY=7 + +# allow keeping local customizations in a separate file +if [ -r /etc/updatedb.findutils.cron.local ] ; then + . /etc/updatedb.findutils.cron.local +fi +export FINDOPTIONS PRUNEFS PRUNEPATHS NETPATHS LOCALUSER + +# Set the task to run with desired I/O priority if possible +# Linux supports io scheduling priorities and classes since +# 2.6.13 with the CFQ io scheduler +if [ -x /usr/bin/ionice ] && [ "${UPDATDB_NO_IONICE}" = "" ]; then + # don't run ionice if kernel version < 2.6.13 + KVER=$(uname -r) + case "$KVER" in + 2.[012345]*) ;; + 2.6.[0-9]) ;; + 2.6.[0-9].*) ;; + 2.6.1[012]*) ;; + *) + # Avoid providing "-n" when IONICE_CLASS isn't 1 or 2 + case "$IONICE_CLASS" in + 1|2) priority="-n ${IONICE_PRIORITY:-7}" ;; + *) priority="" ;; + esac + ionice -c $IONICE_CLASS $priority -p $$ > /dev/null 2>&1 || true + ;; + esac +fi + +if getent passwd $LOCALUSER > /dev/null ; then + cd / && nice -n ${NICE:-10} updatedb.findutils 2>/dev/null +else + echo "User $LOCALUSER does not exist." + exit 1 +fi