Add Record::OPAC and Search::Bath tests.
[irspy-moved-to-github.git] / bin / irspy-update.sh
1 #!/bin/sh
2 # Copyright (c) 2010 Index Data, http://www.indexdata.com
3 #
4 # irspy-update.sh - wrapper for irspy.pl
5 #
6 # run irspy with a smaller set of records in a loop to avoid out-of-memory
7 #
8 # for a fast update, run this:
9 #       $ env irspy_test=Quick ./irspy-update.sh
10
11 home=/usr/local/src/git
12 cd $home/irspy/bin || exit 2
13 logdir=../log
14 lockfile=$logdir/irspy-update.lock
15 statusfile=$logdir/irspy-last-update.log
16
17 # run a full update by default, use Quick for a fast update
18 : ${irspy_test=Main}
19
20 mkdir -p $logdir || exit2
21
22 if [ -f $lockfile ]; then
23     pid=`cat $lockfile`
24     if kill -0 $pid 2>/dev/null; then
25         echo "This script is already running with pid: $pid"
26         exit 1
27     fi
28 fi
29 echo $$ > $lockfile || exit 2
30
31 weekday=`date '+%w'`
32 for i in 0 1 2 3 4 5 6
33 do
34    logfile=$logdir/irspy-mod-$i.log.$weekday
35    YAZ_LOG=irspy,irspy_test,irspy_task nice -10 time perl -I../lib irspy.pl -n 50 -d -M 3500 -f'cql.allRecords=1 not zeerex.disabled = 1' -t $irspy_test -m 7,$i localhost:8018/IR-Explain---1 > $logfile 2>&1
36
37    sleep 1 # catch ctr-c before compressing the log
38    gzip -f $logfile
39 done
40
41 rm -f $lockfile
42 date > $statusfile
43