Last active
May 19, 2022 13:53
-
-
Save 1activegeek/9a932346d85d20123eb3a60d3b03a095 to your computer and use it in GitHub Desktop.
Healthchecks.io Bash Script
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 | |
## Checks get listed here as variables with a call to their respective command | |
## Sub token with Organizr API token | |
radarr=$(curl -o /dev/null -s -w "%{http_code}\n" -H "token: token" https://domain.com/radarr) | |
sonarr=$(curl -o /dev/null -s -w "%{http_code}\n" -H "token: token" https://domain.com/sonarr) | |
ombi=$(curl -o /dev/null -s -w "%{http_code}\n" -H "token: token" https://domain.com/requests) | |
plex=$(curl -L -o /dev/null -s -w "%{http_code}\n" -H "token: token" https://domain.com/plex) | |
domain=$(curl -o /dev/null -s -w "%{http_code}\n" -H "token: token" https://domain.com/) | |
## Store URL with UUID for each check here | |
radarr_URL='https://hc-ping.com/UUID' | |
sonarr_URL='https://hc-ping.com/UUID' | |
ombi_URL='https://hc-ping.com/UUID' | |
plex_URL='https://hc-ping.com/UUID' | |
domain_URL='https://hc-ping.com/UUID' | |
## Checks and response go here | |
if [ "$radarr" = "200" ]; then | |
curl -fsS --retry 3 $radarr_URL > /dev/null | |
else | |
curl -fsS --retry 3 $radarr_URL/fail > /dev/null | |
fi | |
if [ "$sonarr" = "200" ]; then | |
curl -fsS --retry 3 $sonarr_URL > /dev/null | |
else | |
curl -fsS --retry 3 $sonarr_URL/fail > /dev/null | |
fi | |
if [ "$ombi" = "200" ]; then | |
curl -fsS --retry 3 $ombi_URL > /dev/null | |
else | |
curl -fsS --retry 3 $ombi_URL/fail > /dev/null | |
fi | |
if [ "$plex" = "200" ]; then | |
curl -fsS --retry 3 $plex_URL > /dev/null | |
else | |
curl -fsS --retry 3 $plex_URL/fail > /dev/null | |
fi | |
if [ "$domain" = "200" ]; then | |
curl -fsS --retry 3 $domain_URL > /dev/null | |
else | |
curl -fsS --retry 3 $domain_URL/fail > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment