Create a little tool to push service status to UR

This commit is contained in:
Melissa Avery-Weir
2020-09-01 15:38:14 -04:00
parent 90ddc605d1
commit ec2f391732

View File

@@ -0,0 +1,15 @@
#!/bin/bash
# Originally from https://maslosoft.com/kb/watching-for-service-with-cron/
# Updated to use Uptime Robot's heartbeat service
service=$1
heartbeat_id=$2
/bin/systemctl -q is-active "$service.service"
status=$?
if [ "$status" == 0 ]; then
wget --spider "https://heartbeat.uptimerobot.com/$heartbeat_id"
else
/bin/systemctl start "$service.service"
fi