Skip to content

Instantly share code, notes, and snippets.

@mirzalazuardi
Last active May 23, 2023 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirzalazuardi/705f50974c49e204d104ea84c277d2c7 to your computer and use it in GitHub Desktop.
Save mirzalazuardi/705f50974c49e204d104ea84c277d2c7 to your computer and use it in GitHub Desktop.
#!/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