2012-01-02 02:09:49 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-06-24 10:57:18 +02:00
|
|
|
# for a production environment with high-availability requirement,
|
|
|
|
# (and if you are using the debian version of yacy)
|
|
|
|
# add the following line in /etc/crontab
|
2012-06-24 10:58:09 +02:00
|
|
|
# 0 * * * * root cd /usr/share/yacy/bin && ./checkalive.sh
|
2012-01-02 02:09:49 +01:00
|
|
|
|
2012-05-29 13:08:27 +02:00
|
|
|
port=$(grep ^port= ../DATA/SETTINGS/yacy.conf |cut -d= -f2)
|
|
|
|
RESULT=`wget -t 1 --spider http://localhost:$port/Status.html 2>&1`
|
2012-01-02 02:09:49 +01:00
|
|
|
FLAG=0
|
|
|
|
|
|
|
|
for x in $RESULT; do
|
|
|
|
if [ "$x" = '200' ]; then
|
|
|
|
FLAG=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $FLAG -eq '0' ]; then
|
|
|
|
cd ..
|
|
|
|
timeout 30s ./stopYACY.sh
|
|
|
|
./killYACY.sh
|
|
|
|
rm DATA/yacy.running
|
|
|
|
./startYACY.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit
|