From 14e8996e9060da50fd6bd438b1310b21a7a6ea79 Mon Sep 17 00:00:00 2001 From: Simon L Date: Mon, 21 Aug 2023 12:38:58 +0200 Subject: [PATCH] nextcloud - add stop_grace_period of 600s Signed-off-by: Simon L --- Containers/nextcloud/cron.sh | 15 ++++++++++++++- php/containers.json | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Containers/nextcloud/cron.sh b/Containers/nextcloud/cron.sh index 0fe5f589..87f6bf7a 100644 --- a/Containers/nextcloud/cron.sh +++ b/Containers/nextcloud/cron.sh @@ -1,7 +1,20 @@ #!/bin/bash set -eu +wait_for_cron() { + set -x + while [ -n "$(pgrep -f /var/www/html/cron.php)" ]; do + echo "Waiting for cron to stop..." + sleep 5 + done + echo "Cronjob successfully exited." + set +x +} + +trap wait_for_cron SIGINT SIGTERM + while true; do php -f /var/www/html/cron.php & - sleep 5m + sleep 5m & + wait $! done diff --git a/php/containers.json b/php/containers.json index d3047dfd..e39be660 100644 --- a/php/containers.json +++ b/php/containers.json @@ -205,6 +205,7 @@ "TALK_RECORDING_HOST=nextcloud-aio-talk-recording", "FULLTEXTSEARCH_PASSWORD=%FULLTEXTSEARCH_PASSWORD%" ], + "stop_grace_period": 600, "restart": "unless-stopped", "devices": [ "/dev/dri"