From bfdece1c237e0a0d7ca348cd554feb7d8e87d456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Bernardini?= Date: Wed, 26 May 2021 15:45:24 +0200 Subject: [PATCH 1/3] add ENABLE_PERIODIC_VISIT_LOCATE opt-in This will trigger `visit:locate` every hour --- docker/docker-entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 1f9337c4..b1923fe5 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -21,6 +21,15 @@ if [ ! -z "${GEOLITE_LICENSE_KEY}" ]; then php bin/cli visit:download-db -n -q fi +# Periodicaly run visit:locate every hour +# https://shlink.io/documentation/long-running-tasks/#locate-visits +# set env var "ENABLE_PERIODIC_VISIT_LOCATE=1" to enable +if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then + echo "Starting periodic visite locate..." + echo "0 * * * * php bin/cli visit:locate -q" > /etc/crontabs/root + /usr/sbin/crond & +fi + # When restarting the container, swoole might think it is already in execution # This forces the app to be started every second until the exit code is 0 until php vendor/bin/laminas mezzio:swoole:start; do sleep 1 ; done From b9e5eaf6899c56cb493720084acce5a4ce63cfd8 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 30 May 2021 17:41:00 +0200 Subject: [PATCH 2/3] Update docker/docker-entrypoint.sh --- docker/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index b1923fe5..9a199028 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -26,7 +26,7 @@ fi # set env var "ENABLE_PERIODIC_VISIT_LOCATE=1" to enable if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then echo "Starting periodic visite locate..." - echo "0 * * * * php bin/cli visit:locate -q" > /etc/crontabs/root + echo "0 * * * * php /etc/shlink/bin/cli visit:locate -q" > /etc/crontabs/root /usr/sbin/crond & fi From 58262e8604a5509d306689d1978efe4641e1fc37 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 30 May 2021 17:41:40 +0200 Subject: [PATCH 3/3] Update docker/docker-entrypoint.sh --- docker/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 9a199028..915c5f83 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -23,7 +23,7 @@ fi # Periodicaly run visit:locate every hour # https://shlink.io/documentation/long-running-tasks/#locate-visits -# set env var "ENABLE_PERIODIC_VISIT_LOCATE=1" to enable +# set env var "ENABLE_PERIODIC_VISIT_LOCATE=true" to enable if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then echo "Starting periodic visite locate..." echo "0 * * * * php /etc/shlink/bin/cli visit:locate -q" > /etc/crontabs/root