-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
indexer.main.sh.in
executable file
·46 lines (30 loc) · 1.13 KB
/
indexer.main.sh.in
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
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
MAINTMPFILE="/var/run/piler/main.indexer.tmp"
CONFIG_FILE="SYSCONFDIR/piler/sphinx.conf"
PRIORITY="mail.info"
TOUCHFILE="/var/piler/stat/indexer"
MAIN_INDEX="main1"
if [[ -f SYSCONFDIR/piler/MANTICORE ]]; then
CONFIG_FILE=SYSCONFDIR/piler/manticore.conf
fi
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
finish() {
rm -f "$MAINTMPFILE"
}
if [[ -f "$MAINTMPFILE" ]]; then
echo "INDEXER ERROR: indexer merging to main index is already running. It started at $(cat "$MAINTMPFILE")" | logger -p "$PRIORITY"
exit 1
fi
date > "$MAINTMPFILE"
touch "$TOUCHFILE"
trap finish EXIT
echo "INDEXER INFO: merging to main started" | logger -p "$PRIORITY"
indexer --config "$CONFIG_FILE" --quiet --merge "$MAIN_INDEX" dailydelta1 --merge-dst-range deleted 0 0 --rotate
echo "INDEXER INFO: merging to main finished" | logger -p "$PRIORITY"
sleep 5
echo "INDEXER INFO: resetting daily delta started" | logger -p "$PRIORITY"
indexer --config "$CONFIG_FILE" --quiet dailydelta1 --rotate
echo "INDEXER INFO: resetting daily delta finished" | logger -p "$PRIORITY"