📄 zebractl.in
字号:
#!/bin/bash## 20sep1999/kj lee@arco.de## control script for zebra system# type "zebractl help" for full usage information## this script was stolen from apachectl, distributed with apache 1.3.9#PATH=@prefix@/bin:$PATH# set base directory# all data and directories are relative to this directoryBASEDIR=$PWDCFG=$BASEDIR/zebra.cfgDATADIR=$BASEDIR/objects-xmlZEBRADIR=$BASEDIR/zebraSRVLOG=$ZEBRADIR/log/zebrasrv.logIDXLOG=$ZEBRADIR/log/zebraidx.logPIDFILE=$ZEBRADIR/run/zebrasrv.pidZEBRAIDX="zebraidx -c $CFG -g harvest" # -v none"ZEBRASRV="zebrasrv -c $CFG -w $BASEDIR -l $SRVLOG @:9999"######################################## check status of server process ########################################function check_pid { # check for pidfile if [ -f $PIDFILE ]; then PID=`cat $PIDFILE` if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then STATUS="zebrasrv (pid $PID) running" RUNNING=1 else STATUS="zebrasrv (pid $PID?) not running" RUNNING=0 fi else STATUS="zebrasrv (no pid file) not running" RUNNING=0 fi}# start workARGV="$@"if [ "x$ARGV" = "x" ]; then ARGS="help"fifor ARG in $@ $ARGSdo case $ARG in analyze) $ZEBRAIDX -s update $DATADIR ;; index) $ZEBRAIDX update $DATADIR 2>> $IDXLOG echo "Do 'zebractl commit' to register the updated index."; ;; commit) $ZEBRAIDX commit 2>> $IDXLOG ;; fastindex) $ZEBRAIDX -n update $DATADIR 2>> $IDXLOG ;; fullindex) $ZEBRAIDX update $DATADIR 2>> $IDXLOG $ZEBRAIDX commit 2>> $IDXLOG ;; start) check_pid if [ $RUNNING -eq 1 ]; then echo "$0 $ARG: zebrasrv (pid $PID) already running" continue fi $ZEBRASRV & # wait until zebrasrv has written its pidfile sleep 3 check_pid if [ $RUNNING -eq 1 ]; then echo "$0 $ARG: zebrasrv started" else echo "$0 $ARG: zebrasrv could not be started" fi ;; stop) check_pid if [ $RUNNING -eq 0 ]; then echo "$0 $ARG: $STATUS" continue fi if kill $PID ; then echo "$0 $ARG: zebrasrv stopped" else echo "$0 $ARG: zebrasrv could not be stopped" fi ;; restart) check_pid if [ $RUNNING -eq 0 ]; then echo "$0 $ARG: zebrasrv not running, trying to start" $ZEBRASRV & sleep 3 check_pid if [ $RUNNING -eq 1 ]; then echo "$0 $ARG: zebrasrv started" else echo "$0 $ARG: zebrasrv could not be started" fi else if kill $PID ; then $ZEBRASRV & sleep 3 check_pid if [ $RUNNING -eq 1 ]; then echo "$0 $ARG: zebrasrv restarted" else echo "$0 $ARG: zebrasrv could not be restarted" fi else echo "$0 $ARG: couldn't stop zebrasrv for restart" fi fi ;; *) echo echo "Usage: $0 <analyze|index|commit|fastindex|fullindex|start|stop|restart>" cat <<EOFanalyze - don't make any changes, just show what will be doneindex - index changes for merging to main zebra index with commitcommit - commit index changesfastindex - update zebra index without shadowing (fast but database is not accessible until finished)fullindex - update zebra index and commit changesstart - start zebra serverstop - stop zebra serverrestart - restart zebra serverhelp - this screenEOF ;; esacdone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -