piler/init.d/rc.searchd.in
2013-03-20 09:12:37 +01:00

51 lines
688 B
Bash

#!/bin/sh
##
##
NAME=searchd
PID_FILE=/var/run/piler/searchd.pid
PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}`
start() {
echo "starting searchd . . ."
su piler -c 'BINDIR/searchd'
}
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."
else
echo "${NAME} is not running."
fi
;;
restart)
stop;
sleep 1;
start;
;;
*)
echo "Usage: $0 start|stop|restart|status"
esac