Created
April 8, 2021 14:40
-
-
Save andreasottosson/f81dd15ebc408ae0723c03969ce93ac4 to your computer and use it in GitHub Desktop.
Check if server is up or notify via Pushover
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 | |
api_token= | |
user_key= | |
server=10.0.1.3 | |
if nc -z $server 22 2>/dev/null; then | |
echo "Server ✓" | |
else | |
echo "Server ✗" | |
curl -s \ | |
--form-string "token=$api_token" \ | |
--form-string "user=$user_key" \ | |
--form-string "message=Server is down ✗" \ | |
https://api.pushover.net/1/messages.json | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment