From e76c71ab48fe03e12f358f0b23e28540ddb36641 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Wed, 26 Feb 2020 17:17:54 +0100 Subject: [PATCH] Only do an full elasticsearch indexing if the skip file is not present. --- run_elasticsearch.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/run_elasticsearch.sh b/run_elasticsearch.sh index 4d5fb0c..4480c9c 100755 --- a/run_elasticsearch.sh +++ b/run_elasticsearch.sh @@ -1,7 +1,15 @@ #!/bin/bash - -pgrep -af fulltextsearch | grep -qv grep || { su -c "php /var/www/html/occ fulltextsearch:index -q" -s "/bin/bash" www-data; } -pgrep -af fulltextsearch | grep -qv grep || nohup su -c "php /var/www/html/occ fulltextsearch:live -q" -s "/bin/bash" www-data &>/dev/null & +STATEFILE=/var/www/html/.skip_elasticsearch_indexing +pgrep -af fulltextsearch | grep -qv grep +if [ $? -ne 0 ] +then + if ! test -f $STATEFILE + then + su -c "php /var/www/html/occ fulltextsearch:index -q" -s "/bin/bash" www-data + touch $STATEFILE + fi + nohup su -c "php /var/www/html/occ fulltextsearch:live -q" -s "/bin/bash" www-data &>/dev/null & +fi trap "{ echo EXITING; pkill -f -SIGTERM 'fulltextsearch'; }" SIGKILL SIGTERM