mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 07:30:12 +01:00
b73a2765b6
Change-Id: I0e1a4df6cf54e10b407f7df8b58d94fe1ae87ed0 Signed-off-by: SJ <sj@acts.hu>
75 lines
1.3 KiB
Bash
75 lines
1.3 KiB
Bash
#!/bin/sh
|
|
##
|
|
##
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: pilersearch
|
|
# 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
|
|
|
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
|
|
|
NAME=searchd
|
|
PID_FILE=/var/run/piler/searchd.pid
|
|
PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}`
|
|
|
|
start() {
|
|
echo "starting searchd . . ."
|
|
|
|
if [ ! -d /var/run/piler ]; then
|
|
mkdir -p /var/run/piler
|
|
chown piler:piler /var/run/piler
|
|
fi
|
|
|
|
if [ `id -u` -eq 0 ]; then
|
|
su piler -c "searchd --config SYSCONFDIR/piler/sphinx.conf"
|
|
else
|
|
searchd
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
echo "stopping searchd"
|
|
kill ${PID_NUMBER}
|
|
}
|
|
|
|
check_status(){
|
|
test -f /proc/${PID_NUMBER}/status
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start;
|
|
;;
|
|
|
|
stop)
|
|
stop;
|
|
;;
|
|
|
|
status)
|
|
if check_status;
|
|
then
|
|
echo "${NAME} is running."
|
|
exit 0
|
|
else
|
|
echo "${NAME} is not running."
|
|
exit 1
|
|
fi
|
|
;;
|
|
|
|
restart)
|
|
stop;
|
|
sleep 1;
|
|
start;
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 start|stop|restart|status"
|
|
esac
|
|
|