Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2
mlocate
mlocate.cron
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mlocate.cron of Package mlocate
#! /bin/sh set -e # ensure we have proper umask bnc#941296 umask 0022 # check if we run on battery and if so then don't run 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 # check if we are already running (lockfile) LOCKFILE="/var/lock/mlocate.daily.lock" if [ -e "${LOCKFILE}" ]; then echo >&2 "Warning: \"${LOCKFILE}\" already present, not running updatedb." exit 1 fi touch "${LOCKFILE}" # trap the lockfile only if we really run the updatedb trap "rm -f ${LOCKFILE}" EXIT # source the user specified variables if [ -f /etc/sysconfig/locate ] ; then . /etc/sysconfig/locate # Compat code for including variables from findutils-locate # where the values were store in /etc/sysconfig/locate if [ -n "${UPDATEDB_PRUNEFS}" ] ; then UPDATEDB_PRUNEFS="--add-prunefs=\"${UPDATEDB_PRUNEFS}\"" fi if [ -n "${UPDATEDB_PRUNEPATHS}" ] ; then UPDATEDB_PRUNEPATHS="--add-prunepaths=\"${UPDATEDB_PRUNEPATHS}\"" fi fi # check if user said he want the db generated if [ -z "${RUN_UPDATEDB}" ] || [ "${RUN_UPDATEDB}" != "yes" ] ; then exit 0 fi # check the config file NODEVS="" if [ ! -f /etc/updatedb.conf ]; then NODEVS="-f $(< /proc/filesystems awk '$1 == "nodev" && $2 != "rootfs" { print $2 }')" fi # alter the priority of the updatedb process if [ -x /usr/bin/renice ]; then /usr/bin/renice +${NICE:-19} -p $$ > /dev/null 2>&1 fi if [ -x /usr/bin/ionice ] && /usr/bin/ionice -c3 true 2>/dev/null; then /usr/bin/ionice -c${IONICE_CLASS:-2} -n${IONICE_PRIORITY:-7} -p $$ > /dev/null 2>&1 fi # run the updatedb if possible if [ -x /usr/bin/updatedb ]; then if [ -z "${RUN_UPDATEDB_AS}" ] ; then RUN_UPDATEDB_AS=root fi # change the perms to the var directory to our desired user chown -R "${RUN_UPDATEDB_AS}":root /var/lib/mlocate # change the user and run the updatedb under it /usr/bin/su "${RUN_UPDATEDB_AS}" -c "/usr/bin/updatedb ${NODEVS} ${UPDATEDB_PRUNEFS} ${UPDATEDB_PRUNEPATHS}" else echo >&2 "Warning: \"/usr/bin/updatedb\" is not executable, unable to run updatedb." exit 0 fi
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor