Last active
May 13, 2020 18:32
-
-
Save g3rhard/321a965343ed51138dd8858c95918686 to your computer and use it in GitHub Desktop.
Check status cloudflared service via Monit. https://www.reddit.com/r/pihole/comments/b94dcr/cloudflare_dns_over_https_doesnt_work_after_a/
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 | |
TEMP_STATUS="/tmp/cloudflared.status" | |
TEMP_ERR="/tmp/cloudflared.err" | |
TEMP_LOCK="/tmp/checkCloudflared.lock" | |
lockfile -r 0 $TEMP_LOCK || exit 1 | |
sudo systemctl status cloudflared > $TEMP_STATUS | |
cat $TEMP_STATUS | grep "failed to connect to an HTTPS backend" > $TEMP_ERR | |
cat $TEMP_STATUS | grep "failed to perform an HTTPS request" >> $TEMP_ERR | |
if [ -s $TEMP_ERR ] | |
then | |
rm -f $TEMP_STATUS $TEMP_ERR $TEMP_LOCK | |
exit 1 | |
fi | |
rm -f $TEMP_STATUS $TEMP_ERR $TEMP_LOCK |
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
check program cloudflared with path "/bin/bash -c '/usr/scripts/cloudflared_check.sh'" | |
start program = "/bin/systemctl start cloudflared" | |
stop program = "/bin/systemctl stop cloudflared" | |
if status = 1 then restart | |
if 1 restart within 1 cycle then exec "/bin/bash -c '/usr/local/bin/slack-webhook.rb'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment