Created
December 6, 2022 17:56
-
-
Save likid0/14bfd253768ec55b73e8f35ca4ac1b54 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
SITE1=cluster1 | |
SITE2=cluster2 | |
TOKEN='irw4CeuS7CgbSLMk6/k2YDJkAXmAKdndCYMZ4XXTYtwrTXgX6oghTbS4su7WMq4WAi' | |
HOOK1=http://rocket-chat-rocket-chat.apps.bos1.chris.ocs.ninja/hooks/${TOKEN} | |
HOOK2=http://rocket-chat-rocket-chat.apps.bos2.chris.ocs.ninja/hooks/${TOKEN} | |
TIME=10 | |
export NUMBER1=0 | |
export NUMBER2=0 | |
while true ; do | |
sleep $TIME | |
export NUMBER=$((NUMBER+1)) | |
if curl -I ${HOOK1} > /dev/null 2>&1 | |
then | |
if [ $(curl -I ${HOOK1} 2>/dev/null | head -n 1 | cut -d ' ' -f2 ) -eq "200" ] | |
then | |
curl -X POST -H 'Content-Type: application/json' --data '{"username": "CLUSTER1","icon_emoji": ":alien:","text":"Sending Message to test MetroDR Demo. '" $(date)"'","attachments":[{"title":"'"Site: ${SITE1}"'","text":"'"DR message ${NUMBER1}"'","color":"#0ff004"}]}' ${HOOK1} | |
export NUMBER1=$((NUMBER1+1)) | |
fi | |
fi | |
if curl -I ${HOOK2} > /dev/null 2>&1 | |
then | |
if [ $(curl -I ${HOOK2} 2>/dev/null | head -n 1 | cut -d ' ' -f2 ) -eq "200" ] | |
then | |
curl -X POST -H 'Content-Type: application/json' --data '{"username": "CLUSTER2","icon_emoji": ":robot:","text":"Sending Message to test MetroDR Demo. '" $(date)"'","attachments":[{"title":"'"Site: ${SITE2}"'","title_link":"https://rocket.chat","text":"'"DR message ${NUMBER2}"'","color":"#f06f04"}]}' ${HOOK2} | |
export NUMBER2=$((NUMBER2+1)) | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment