piler/init.d/rc.searchd.in
2013-07-30 11:13:17 +02:00

53 lines
753 B
Bash

#!/bin/sh
##
##
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 . . ."
su piler -c 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