File: mlocate.cron.daily

package info (click to toggle)
mlocate 0.26-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,112 kB
  • sloc: ansic: 10,201; sh: 9,898; makefile: 82; sed: 16
file content (32 lines) | stat: -rw-r--r-- 628 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/bash

set -e

# skip in favour of systemd timer
if [ -d /run/systemd/system ]; then
    exit 0
fi

[ -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

# See nocache(1)
NOCACHE=
if [ -x /usr/bin/nocache ]; then
    NOCACHE="/usr/bin/nocache"
fi

flock --nonblock /run/mlocate.daily.lock $NOCACHE $IONICE nice /usr/bin/updatedb.mlocate