yacy_search_server/bin/checkalive.sh
luccioman 17ad1f7e65 Added support for custom DATA path in shell scripts
When the YACY_DATA_PATH environment variable is set, shell scripts will
now use the given path instead of relative ../DATA which remains the
default when the variable is not set.

Necessary in the context of Snap package (see issue #254) as YaCy is
started with startYACY.sh and an absolute DATA parent path in parameter.
2018-11-26 18:26:52 +01:00

22 lines
510 B
Bash
Executable File

#!/usr/bin/env sh
# 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
# 0 * * * * root cd /usr/share/yacy/bin && ./checkalive.sh
cd "`dirname $0`"
. ./checkDataFolder.sh
FLAG=0
if [ `./apicall.sh /Status.html | grep "</html>"` ]; then
FLAG=1
fi
if [ $FLAG -eq '0' ]; then
cd ..
timeout 30s ./stopYACY.sh
./killYACY.sh
rm "$YACY_DATA_PATH/yacy.running"
./startYACY.sh
fi
exit