added script for healthchecks.io ping

This commit is contained in:
Simon Pirkelmann 2022-09-10 19:17:49 +02:00
parent f29cbb40f6
commit b8f4d4f1c5
2 changed files with 14 additions and 0 deletions

13
root_overlay/bin/healthcheck.sh Executable file
View File

@ -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

View File

@ -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