2013-07-09 10:12:42 +02:00
#!/bin/bash
2013-07-09 11:32:48 +02:00
export PATH = /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
2013-07-09 10:12:42 +02:00
MAINTMPFILE = /var/run/piler/main.indexer.tmp
2013-07-09 11:32:48 +02:00
INDEXER = indexer
2013-07-09 10:12:42 +02:00
PRIORITY = mail.error
2013-08-09 10:13:54 +02:00
TOUCHFILE = /var/piler/stat/indexer
2013-07-09 10:12:42 +02:00
2013-07-09 10:30:48 +02:00
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
2013-07-09 10:12:42 +02:00
date > $MAINTMPFILE
2013-08-09 10:13:54 +02:00
touch $TOUCHFILE
2013-07-09 10:12:42 +02:00
function finish {
rm -f $MAINTMPFILE
}
trap finish EXIT
2013-07-09 10:30:48 +02:00
echo "INDEXER INFO: merging to main started" | logger -p $PRIORITY
2013-07-09 10:12:42 +02:00
$INDEXER --quiet --merge main1 dailydelta1 --merge-dst-range deleted 0 0 --rotate
2013-07-09 10:30:48 +02:00
echo "INDEXER INFO: merging to main finished" | logger -p $PRIORITY
2013-07-09 10:12:42 +02:00
sleep 5
2013-07-09 10:30:48 +02:00
echo "INDEXER INFO: resetting daily delta started" | logger -p $PRIORITY
2013-07-09 10:12:42 +02:00
$INDEXER --quiet dailydelta1 --rotate
2013-07-09 10:30:48 +02:00
echo "INDEXER INFO: resetting daily delta finished" | logger -p $PRIORITY
2013-07-09 10:12:42 +02:00