2012-02-15 10:21:57 +01:00
|
|
|
#!/bin/sh
|
|
|
|
##
|
|
|
|
##
|
|
|
|
|
2013-12-14 11:10:16 +01:00
|
|
|
### BEGIN INIT INFO
|
2015-03-17 12:02:08 +01:00
|
|
|
# Provides: pilersearch
|
2013-12-14 11:10:16 +01:00
|
|
|
# Required-Start: $remote_fs $syslog $named $network $time
|
|
|
|
# Required-Stop: $remote_fs $syslog $named $network
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
# Short-Description: sphinxsearch
|
|
|
|
# Description: sphinxsearch
|
|
|
|
### END INIT INFO
|
|
|
|
|
2013-07-30 11:13:17 +02:00
|
|
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
|
|
|
|
2012-02-15 10:21:57 +01:00
|
|
|
NAME=searchd
|
2013-03-20 09:12:37 +01:00
|
|
|
PID_FILE=/var/run/piler/searchd.pid
|
2022-08-27 11:03:29 +02:00
|
|
|
PID_NUMBER=$(test -f ${PID_FILE} && cat ${PID_FILE})
|
|
|
|
CONFIG_FILE=sphinx.conf
|
|
|
|
|
|
|
|
if [ -f SYSCONFDIR/piler/MANTICORE ]; then
|
|
|
|
CONFIG_FILE=manticore.conf
|
|
|
|
fi
|
|
|
|
|
2012-02-15 10:21:57 +01:00
|
|
|
|
|
|
|
start() {
|
|
|
|
echo "starting searchd . . ."
|
2014-09-22 11:13:55 +02:00
|
|
|
|
|
|
|
if [ ! -d /var/run/piler ]; then
|
|
|
|
mkdir -p /var/run/piler
|
|
|
|
chown piler:piler /var/run/piler
|
|
|
|
fi
|
|
|
|
|
2022-08-27 11:03:29 +02:00
|
|
|
if [ $(id -u) -eq 0 ]; then
|
|
|
|
su piler -c "searchd --config SYSCONFDIR/piler/${CONFIG_FILE}"
|
2014-02-18 10:46:23 +01:00
|
|
|
else
|
|
|
|
searchd
|
|
|
|
fi
|
2012-02-15 10:21:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
echo "stopping searchd"
|
2022-08-27 11:03:29 +02:00
|
|
|
kill "$PID_NUMBER"
|
2012-02-15 10:21:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
check_status(){
|
|
|
|
test -f /proc/${PID_NUMBER}/status
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start;
|
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
|
|
|
stop;
|
|
|
|
;;
|
|
|
|
|
|
|
|
status)
|
|
|
|
if check_status;
|
|
|
|
then
|
2015-04-28 09:57:32 +02:00
|
|
|
echo "${NAME} is running."
|
|
|
|
exit 0
|
2012-02-15 10:21:57 +01:00
|
|
|
else
|
2015-04-28 09:57:32 +02:00
|
|
|
echo "${NAME} is not running."
|
|
|
|
exit 1
|
2012-02-15 10:21:57 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
restart)
|
|
|
|
stop;
|
|
|
|
sleep 1;
|
|
|
|
start;
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 start|stop|restart|status"
|
|
|
|
esac
|
|
|
|
|