Skip to content

Commit

Permalink
Merge pull request #3214 from nextcloud/enh/noid/add-stop-grace-perio…
Browse files Browse the repository at this point in the history
…d-nextcloud

nextcloud - add stop_grace_period of 600s and wait for cron to finish during that time
  • Loading branch information
szaimen authored Dec 1, 2023
2 parents 173b3e2 + 14e8996 commit 890ba86
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Containers/nextcloud/cron.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions php/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"APACHE_IP_BINDING=%APACHE_IP_BINDING%",
"THIS_IS_AIO=true"
],
"stop_grace_period": 600,
"restart": "unless-stopped",
"devices": [
"/dev/dri"
Expand Down

0 comments on commit 890ba86

Please sign in to comment.