#!/bin/sh
. /etc/rc.d/init.d/functions
log_file="/tmp/sphinx_init.log"
appName="Sphinx"
argv1=$1
argv2=$2
stop(){
/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/$argv2.conf --stop > $log_file 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"Stoping $appName: " /bin/true
else
action $"Stoping $appName: " /bin/false
fi
return $ret
}
start(){
/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/$argv2.conf > $log_file 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"Starting $appName: " /bin/true
else
action $"Starting $appName: " /bin/false
fi
return $ret
}
indexer(){
/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/$argv2.conf --all > $log_file 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $"$appName making index: " /bin/true
else
action $"$appName making index: " /bin/false
fi
return $ret
}
case $1 in
restart)
stop
sleep 1
#indexer
start
;;
stop)
stop
;;
start)
start
;;
esac
exit 0
操作:
/etc/init.d/sphinx restart index_main
Stoping Sphinx: [ OK ]
Starting Sphinx: [ OK ]