Skip to content

Commit

Permalink
Merge pull request dmwm#1471 from arooshap/master
Browse files Browse the repository at this point in the history
Fixing issue with the race conditions.
  • Loading branch information
arooshap authored May 3, 2024
2 parents ffa1a61 + 15810b4 commit 7d33533
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ RUN crontab /data/crontab.txt
ADD run.sh $WDIR/run.sh
ADD monitor.sh $WDIR/monitor.sh
ADD alerts.sh $WDIR/alerts.sh
COPY authmap-prod.cron /tmp/authmap-prod.cron
COPY authmap-preprod.cron /tmp/authmap-preprod.cron
COPY authmap-test.cron /tmp/authmap-test.cron
COPY authmap-prod.sh /tmp/authmap-prod.sh
COPY authmap-preprod.sh /tmp/authmap-preprod.sh
COPY authmap-test.sh /tmp/authmap-test.sh
COPY copy_cron.sh $WDIR/copy_cron.sh


Expand Down
2 changes: 0 additions & 2 deletions docker/frontend/authmap-preprod.cron

This file was deleted.

8 changes: 8 additions & 0 deletions docker/frontend/authmap-preprod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Print a message to indicate the script is running
echo "authmap-preprod.sh is running"

sleep $((RANDOM % 601))

/data/srv/current/config/frontend/mkauthmap -c /data/srv/current/config/frontend/mkauth.conf -o /data/srv/state/frontend/etc/authmap.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem ; [ $? -ne 0 ] && /bin/bash /data/alerts.sh
2 changes: 0 additions & 2 deletions docker/frontend/authmap-prod.cron

This file was deleted.

7 changes: 7 additions & 0 deletions docker/frontend/authmap-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Print a message to indicate the script is running

sleep $((RANDOM % 601))

/data/srv/current/config/frontend/mkauthmap -c /data/srv/current/config/frontend/mkauth.conf -o /data/srv/state/frontend/etc/authmap.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem ; [ $? -ne 0 ] && /bin/bash /data/alerts.sh
2 changes: 0 additions & 2 deletions docker/frontend/authmap-test.cron

This file was deleted.

6 changes: 6 additions & 0 deletions docker/frontend/authmap-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# Print a message to indicate the script is running
sleep $((RANDOM % 901))

/data/srv/current/config/frontend/mkauthmap -c /data/srv/current/config/frontend/mkauth.conf -o /data/srv/state/frontend/etc/authmap.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem ; [ $? -ne 0 ] && /bin/bash /data/alerts.sh
6 changes: 3 additions & 3 deletions docker/frontend/copy_cron.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
if [ "$ENVIRONMENT" = "k8s-prod" ]; then
# Copy the production cron file
echo "Copying authmap-prod.cron"
cp /tmp/authmap-prod.cron /tmp/authmap.cron
echo "*/15 * * * * /tmp/authmap-prod.sh" > /tmp/authmap.cron
elif [ "$ENVIRONMENT" = "k8s-preprod" ]; then
# Copy the development cron file
echo "Copying authmap-preprod.cron"
cp /tmp/authmap-preprod.cron /tmp/authmap.cron
echo "*/15 * * * * /tmp/authmap-preprod.sh" > /tmp/authmap.cron
elif [[ "$ENVIRONMENT" == k8s-test* ]]; then
# Copy the test cron file
echo "Copying authmap-test.cron"
cp /tmp/authmap-test.cron /tmp/authmap.cron
echo "*/30 * * * * /tmp/authmap-test.sh" > /tmp/authmap.cron

else
echo "Unsupported environment: $ENVIRONMENT"
Expand Down

0 comments on commit 7d33533

Please sign in to comment.