Last active
May 23, 2023 01:37
-
-
Save mirzalazuardi/705f50974c49e204d104ea84c277d2c7 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/sh | |
# echo sudo apt update | |
# sudo apt install -y curl net-tools tmux vim | |
# SLACK_WEBHOOK_URL=https://yourslackwebhookurl | |
hs=`hostname` | |
down_message="$hs logger is not running, please check" | |
while true | |
do | |
if nc -zw1 google.com 443; then | |
if [[ -z `netstat -ano|grep 8000` ]] ; then | |
curl -X POST -H 'Content-type: application/json' --data '{"text": "'"$down_message"'" }' $SLACK_WEBHOOK_URL | |
fi | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment