From 69e5941c8aa856250f60511e1522c67f5bd89150 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Mon, 29 Apr 2024 19:58:55 +0200 Subject: [PATCH 1/7] A few changes to the cronjobs.. --- docker/frontend/authmap-preprod.cron | 2 -- docker/frontend/authmap-preprod.sh | 6 ++++++ docker/frontend/authmap-prod.cron | 2 -- docker/frontend/authmap-prod.sh | 5 +++++ docker/frontend/authmap-test.cron | 2 -- docker/frontend/authmap-test.sh | 4 ++++ docker/frontend/copy_cron.sh | 6 +++--- 7 files changed, 18 insertions(+), 9 deletions(-) delete mode 100644 docker/frontend/authmap-preprod.cron create mode 100644 docker/frontend/authmap-preprod.sh delete mode 100644 docker/frontend/authmap-prod.cron create mode 100644 docker/frontend/authmap-prod.sh delete mode 100644 docker/frontend/authmap-test.cron create mode 100644 docker/frontend/authmap-test.sh diff --git a/docker/frontend/authmap-preprod.cron b/docker/frontend/authmap-preprod.cron deleted file mode 100644 index b76717e13..000000000 --- a/docker/frontend/authmap-preprod.cron +++ /dev/null @@ -1,2 +0,0 @@ -*/15 * * * * 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 - diff --git a/docker/frontend/authmap-preprod.sh b/docker/frontend/authmap-preprod.sh new file mode 100644 index 000000000..26e8fe4fd --- /dev/null +++ b/docker/frontend/authmap-preprod.sh @@ -0,0 +1,6 @@ +#!/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' diff --git a/docker/frontend/authmap-prod.cron b/docker/frontend/authmap-prod.cron deleted file mode 100644 index b76717e13..000000000 --- a/docker/frontend/authmap-prod.cron +++ /dev/null @@ -1,2 +0,0 @@ -*/15 * * * * 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 - diff --git a/docker/frontend/authmap-prod.sh b/docker/frontend/authmap-prod.sh new file mode 100644 index 000000000..6c21ecb54 --- /dev/null +++ b/docker/frontend/authmap-prod.sh @@ -0,0 +1,5 @@ +#!/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' diff --git a/docker/frontend/authmap-test.cron b/docker/frontend/authmap-test.cron deleted file mode 100644 index 2575d1f78..000000000 --- a/docker/frontend/authmap-test.cron +++ /dev/null @@ -1,2 +0,0 @@ -*/30 * * * * 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 - diff --git a/docker/frontend/authmap-test.sh b/docker/frontend/authmap-test.sh new file mode 100644 index 000000000..10773d9c5 --- /dev/null +++ b/docker/frontend/authmap-test.sh @@ -0,0 +1,4 @@ +#!/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' diff --git a/docker/frontend/copy_cron.sh b/docker/frontend/copy_cron.sh index d630855cb..9d301bd87 100755 --- a/docker/frontend/copy_cron.sh +++ b/docker/frontend/copy_cron.sh @@ -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" > /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-prod" > /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 "*/15 * * * * /tmp/authmap-test.sh" > /tmp/authmap.cron else echo "Unsupported environment: $ENVIRONMENT" From 3ea19a0a433688a8213b0be81a3ff2afc06348ec Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Mon, 29 Apr 2024 20:00:48 +0200 Subject: [PATCH 2/7] A few changes to the cronjobs.. --- docker/frontend/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/frontend/Dockerfile b/docker/frontend/Dockerfile index f93d10b3a..63ba0ff45 100644 --- a/docker/frontend/Dockerfile +++ b/docker/frontend/Dockerfile @@ -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 From 3f2c16b3c68d37b2e7de69cce4746b13657ec1f7 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Tue, 30 Apr 2024 07:57:24 +0200 Subject: [PATCH 3/7] A few changes to the cronjobs.. --- docker/frontend/authmap-preprod.sh | 4 +++- docker/frontend/authmap-prod.sh | 4 +++- docker/frontend/authmap-test.sh | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) mode change 100644 => 100755 docker/frontend/authmap-preprod.sh mode change 100644 => 100755 docker/frontend/authmap-prod.sh mode change 100644 => 100755 docker/frontend/authmap-test.sh diff --git a/docker/frontend/authmap-preprod.sh b/docker/frontend/authmap-preprod.sh old mode 100644 new mode 100755 index 26e8fe4fd..aea60d9ea --- a/docker/frontend/authmap-preprod.sh +++ b/docker/frontend/authmap-preprod.sh @@ -3,4 +3,6 @@ # 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' +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 diff --git a/docker/frontend/authmap-prod.sh b/docker/frontend/authmap-prod.sh old mode 100644 new mode 100755 index 6c21ecb54..3c46c4934 --- a/docker/frontend/authmap-prod.sh +++ b/docker/frontend/authmap-prod.sh @@ -2,4 +2,6 @@ # 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' +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 diff --git a/docker/frontend/authmap-test.sh b/docker/frontend/authmap-test.sh old mode 100644 new mode 100755 index 10773d9c5..6d17963ec --- a/docker/frontend/authmap-test.sh +++ b/docker/frontend/authmap-test.sh @@ -1,4 +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' +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 From 0cad68336ee1978b9e23346787485bac38d1810d Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Tue, 30 Apr 2024 08:04:01 +0200 Subject: [PATCH 4/7] A few changes to the cronjobs.. --- docker/frontend/authmap-preprod.sh | 2 +- docker/frontend/authmap-prod.sh | 2 +- docker/frontend/authmap-test.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/frontend/authmap-preprod.sh b/docker/frontend/authmap-preprod.sh index aea60d9ea..0524b0d53 100755 --- a/docker/frontend/authmap-preprod.sh +++ b/docker/frontend/authmap-preprod.sh @@ -5,4 +5,4 @@ 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 +/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 diff --git a/docker/frontend/authmap-prod.sh b/docker/frontend/authmap-prod.sh index 3c46c4934..bad51cc5a 100755 --- a/docker/frontend/authmap-prod.sh +++ b/docker/frontend/authmap-prod.sh @@ -4,4 +4,4 @@ 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 +/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 diff --git a/docker/frontend/authmap-test.sh b/docker/frontend/authmap-test.sh index 6d17963ec..1d77a9cf6 100755 --- a/docker/frontend/authmap-test.sh +++ b/docker/frontend/authmap-test.sh @@ -3,4 +3,4 @@ # 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 +/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 From ceddb291b9ef8e574684ee7c7bd75aee6bc6b135 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Tue, 30 Apr 2024 08:06:33 +0200 Subject: [PATCH 5/7] A few changes to the cronjobs.. --- docker/frontend/copy_cron.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/frontend/copy_cron.sh b/docker/frontend/copy_cron.sh index 9d301bd87..7094a710c 100755 --- a/docker/frontend/copy_cron.sh +++ b/docker/frontend/copy_cron.sh @@ -1,11 +1,11 @@ if [ "$ENVIRONMENT" = "k8s-prod" ]; then # Copy the production cron file echo "Copying authmap-prod.cron" - echo "*/15 * * * * /tmp/authmap-prod" > /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" - echo "*/15 * * * * /tmp/authmap-prod" > /tmp/authmap.cron + echo "*/15 * * * * /tmp/authmap-prod.sh" > /tmp/authmap.cron elif [[ "$ENVIRONMENT" == k8s-test* ]]; then # Copy the test cron file echo "Copying authmap-test.cron" From a2d85f1c1a104ccb90b877db295bb1a0868920f8 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Tue, 30 Apr 2024 08:08:08 +0200 Subject: [PATCH 6/7] A few changes to the cronjobs.. --- docker/frontend/copy_cron.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/frontend/copy_cron.sh b/docker/frontend/copy_cron.sh index 7094a710c..54ae6fc92 100755 --- a/docker/frontend/copy_cron.sh +++ b/docker/frontend/copy_cron.sh @@ -9,7 +9,7 @@ elif [ "$ENVIRONMENT" = "k8s-preprod" ]; then elif [[ "$ENVIRONMENT" == k8s-test* ]]; then # Copy the test cron file echo "Copying authmap-test.cron" - echo "*/15 * * * * /tmp/authmap-test.sh" > /tmp/authmap.cron + echo "*/30 * * * * /tmp/authmap-test.sh" > /tmp/authmap.cron else echo "Unsupported environment: $ENVIRONMENT" From 15810b44c5bbb4aa938be011c81dfc4b8a63c4fc Mon Sep 17 00:00:00 2001 From: "A. Pervaiz" <77356768+arooshap@users.noreply.github.com> Date: Fri, 3 May 2024 15:52:10 +0200 Subject: [PATCH 7/7] Update copy_cron.sh --- docker/frontend/copy_cron.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/frontend/copy_cron.sh b/docker/frontend/copy_cron.sh index 54ae6fc92..4188c4bdd 100755 --- a/docker/frontend/copy_cron.sh +++ b/docker/frontend/copy_cron.sh @@ -5,7 +5,7 @@ if [ "$ENVIRONMENT" = "k8s-prod" ]; then elif [ "$ENVIRONMENT" = "k8s-preprod" ]; then # Copy the development cron file echo "Copying authmap-preprod.cron" - echo "*/15 * * * * /tmp/authmap-prod.sh" > /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"