-../../index/zebraidx -l$LOG init
-../../index/zebraidx -l$LOG update records/*marc
-../../index/zebrasrv -l$LOG unix:socket &
+test -d tmp || mkdir tmp
+test -d lock || mkdir lock
+test -d register || mkdir register
+
+if ../../index/zebraidx -c $pp/zebra.cfg -l $LOG filters|grep grs.marc >/dev/null; then
+ ../../index/zebraidx -c $pp/zebra.cfg -l$LOG init
+else
+ exit 0
+fi
+
+if grep 'UTF-8 to koi8-r unsupported' $LOG >/dev/null; then
+ exit 0
+fi
+../../index/zebraidx -c $pp/zebra.cfg -l$LOG update $pp/records/*marc
+../../index/zebrasrv -c $pp/zebra.cfg -l$LOG unix:socket &