From b8f4d4f1c58943edcdb648622967c91000bf4f3e Mon Sep 17 00:00:00 2001 From: Simon Pirkelmann Date: Sat, 10 Sep 2022 19:17:49 +0200 Subject: [PATCH] added script for healthchecks.io ping --- root_overlay/bin/healthcheck.sh | 13 +++++++++++++ root_overlay/bin/watcher | 1 + 2 files changed, 14 insertions(+) create mode 100755 root_overlay/bin/healthcheck.sh diff --git a/root_overlay/bin/healthcheck.sh b/root_overlay/bin/healthcheck.sh new file mode 100755 index 0000000..1858035 --- /dev/null +++ b/root_overlay/bin/healthcheck.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This script acts as a dead-man-switch for the door pi. +# It sends a ping to healthchecks.io in regular intervals. +# When a ping is missed (e.g. because the pi crashes) healtchecks +# is configured to send a notification that the pi is down. +LOGFILE=/var/log/healthcheck.log +URL=http://hc-ping.com/7cfd6716-ac74-420a-b322-ef8d5746e0fe +while true; do + echo -n "`date +"[%Y-%m-%d %H:%M:%S]"` " >> $LOGFILE + wget -q -O - $URL >> $LOGFILE + echo "" >> $LOGFILE + sleep 15m +done diff --git a/root_overlay/bin/watcher b/root_overlay/bin/watcher index d0631e3..36ca561 100755 --- a/root_overlay/bin/watcher +++ b/root_overlay/bin/watcher @@ -3,5 +3,6 @@ while true; do start-stop-daemon -S -m -p /tmp/poll_desfire.pid -x /bin/poll_desfire -b -- /root/key /tmp/nfc_fifo start-stop-daemon -v -p /tmp/fcpy.pid -S -b -m -v -x /usr/bin/python -- /bin/door.py start-stop-daemon -v -p /tmp/webiface.pid -S -b -m -v -x /usr/bin/python -- /usr/bin/launch_webadmin + start-stop-daemon -v -p /tmp/healthchecks.pid -S -b -m -v -x /bin/sh -- /bin/healthcheck.sh sleep 5 done