Skip to content

Commit

Permalink
Merge pull request #321 from City-of-Helsinki/UHF-8921
Browse files Browse the repository at this point in the history
UHF-8921: added deployment cron prevention script in cron base.sh
  • Loading branch information
rpnykanen authored Sep 27, 2023
2 parents dc3081e + f6d816f commit 1ed719a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docker/openshift/crons/base.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
#!/bin/bash

# Checking if a new deployment is in progress, as we should not run cron while deploying.
if [ ! -n "$OPENSHIFT_BUILD_NAME" ]; then
echo "OPENSHIFT_BUILD_NAME is not defined. Exiting early."
exit 1
fi

while [ "$(drush state:get deploy_id)" != "$OPENSHIFT_BUILD_NAME" ]
do
echo "Current deploy_id $OPENSHIFT_BUILD_NAME not found in state. Probably a deployment is in progress - waiting for completion..."
sleep 60
done

while [ "$(drush state:get system.maintenance_mode)" = "1" ]
do
echo "Maintenance mode on. Probably a deployment is in progress - waiting for completion..."
sleep 60
done

echo "Starting cron: $(date)"

# You can add any additional cron "daemons" here:
Expand Down

0 comments on commit 1ed719a

Please sign in to comment.