mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 20:10:11 +01:00
53 lines
753 B
Bash
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
|
|
|