File: cachecleanup.sh

package info (click to toggle)
sphinxsearch 2.2.11-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,724 kB
  • sloc: cpp: 102,259; xml: 85,608; sh: 9,259; php: 3,790; ansic: 3,158; yacc: 1,969; java: 1,336; ruby: 1,289; python: 1,062; pascal: 912; perl: 381; lex: 275; makefile: 150; sql: 77; cs: 35
file content (17 lines) | stat: -rw-r--r-- 559 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

# cache directory cleanup script example
#
# removes all old cached files with mtime older than index mtime
#
# there MUST be your ACTUAL index names and FULL PATHS to indexfiles

indexnames=( test1 test2 )
indexfiles=( /usr/local/sphinx/test1.spd /benchmarks/work/test/test2.spd )
cachedir=/tmp/cache

for element in $(seq 0 $((${#indexnames[@]} - 1)))
do                
	echo "processing index ${indexnames[$element]}"
	find "$cachedir/${indexnames[$element]}" \( ! -newer "${indexfiles[$element]}" \) -type f -print0 | xargs -0 -r rm -f
done