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
|
2012-02-15 10:21:57 +01:00
|
|
|
PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}`
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-02-18 10:46:23 +01:00
|
|
|
if [ `id -u` -eq 0 ]; then
|
|
|
|
su piler -c searchd
|
|
|
|
else
|
|
|
|
searchd
|
|
|
|
fi
|
2012-02-15 10:21:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
echo "stopping searchd"
|
2012-07-06 15:21:08 +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
|
|
|
|
echo "${NAME} is running."
|
|
|
|
else
|
|
|
|
echo "${NAME} is not running."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
restart)
|
|
|
|
stop;
|
|
|
|
sleep 1;
|
|
|
|
start;
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 start|stop|restart|status"
|
|
|
|
esac
|
|
|
|
|