Parent: [d416ac] (diff)

Download this file

rclcheckneedretry.sh    49 lines (40 with data), 1.3 kB

 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# This script is called by recollindex to determine if it would be
# worth retrying files which previously failed to index.
#
# This is the default implementation, it is pointed to by the
# 'checkneedretryindexscript' variable in the default recoll.conf
#
# The script exits with 0 if retrying should be performed (something
# changed), 1 else.
#
# We check /usr/bin and /usr/local/bin modification date against the
# previous value recorded inside ~/.config/Recoll.org/needidxretrydate
#
# If any argument is given, we record the new state instead of
# generating it (this should be used at the end of an indexing pass
# with retry set).
#
# Bin dirs to be tested:
bindirs="/usr/bin /usr/local/bin $HOME/bin /opt/*/bin"
rfiledir=$HOME/.config/Recoll.org
rfile=$rfiledir/needidxretrydate
nrfile=$rfiledir/tneedidxretrydate
test -d $rfiledir || mkdir -p $rfiledir
# If any argument is given, we are called just to record the new
# state. We do not recompute it as it may have changed during
# indexing, but just move the state in place
if test $# != 0 ; then
mv -f $nrfile $rfile
exit 0
fi
# Compute state of bin dirs and see if anything changed:
> $nrfile
for dir in $bindirs; do
ls -ld $dir >> $nrfile 2> /dev/null
done
if cmp -s $rfile $nrfile ; then
exit 1
else
exit 0
fi