Files
ethereum-rpc-docker/util/sync_alert_nooby.sh
2022-01-12 19:00:12 +01:00

27 lines
791 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
TELEGRAM_AUTH_TOKEN=5077327159:AAELNjCtFZTrLz7h5PW9Td1RTl8beNFgMbo
TELEGRAM_CHAT_ID=-697908946
curl_w() {
curl \
retry-connrefused \
-sf "$@"
}
send_message() {
curl_w -X POST "https://api.telegram.org/bot${TELEGRAM_AUTH_TOKEN}/sendMessage" \
-H "Content-Type: application/json" \
-d "{\"chat_id\": \"${TELEGRAM_CHAT_ID}\", \"text\": \"${*}\", \"disable_notification\": false}"
}
chain_list="goerli ropsten rinkeby geth erigon harmony"
for i in $chain_list; do
output=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' https://bsc-1.stakesquid-db.ml/$i)
if [ $output != '{"jsonrpc":"2.0","id":1,"result":false}' ]; then
send_message "$i not in sync"
fi
done