-
Notifications
You must be signed in to change notification settings - Fork 3
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 #531 from City-of-Helsinki/UHF-10354-test-new-cron…
…-entrypoint UHF-10354: Testing new cron entrypoint
- Loading branch information
Showing
7 changed files
with
77 additions
and
10 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
source /init.sh | ||
|
||
echo "Starting cron: $(date)" | ||
|
||
# You can add any additional cron "daemons" to docker/openshift/crons/ folder. | ||
# | ||
# Example: | ||
# @code | ||
# #!/bin/bash | ||
# while true | ||
# do | ||
# drush some-command | ||
# sleep 600 | ||
# done | ||
# @endcode | ||
|
||
for cron in /crons/*.sh; do | ||
# Skip legacy base.sh script if it exists. | ||
# Skip Kubernetes hooks that are stored in crons directory. | ||
if [[ "${cron##*/}" == "base.sh" ]] || [[ "${cron##*/}" == *-hook.sh ]]; then | ||
continue | ||
elif [[ -r "$cron" ]]; then | ||
echo "Starting $cron" | ||
exec "$cron" & | ||
fi | ||
done | ||
|
||
while true | ||
do | ||
# Rudimentary process supervisor: | ||
# Waits for the next process to terminate. The parent | ||
# process is killed if any subprocess exists with failure. | ||
# OpenShift should then restart the cron pod. | ||
wait -n | ||
exit_code=$? | ||
if [[ "$exit_code" -ne 0 ]]; then | ||
output_error_message "Subprocess failed with exit code $exit_code" | ||
exit 1 | ||
fi | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
while true | ||
do | ||
echo "Running cron: $(date +'%Y-%m-%dT%H:%M:%S%:z')\n" | ||
drush cron | ||
# Sleep for 10 minutes. | ||
sleep 600 | ||
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
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
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
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