-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3214 from nextcloud/enh/noid/add-stop-grace-perio…
…d-nextcloud nextcloud - add stop_grace_period of 600s and wait for cron to finish during that time
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters